mirror of git://git.sysmocom.de/ofono
gdbus: Add g_dbus_add_properties_watch function
Convenient function to create watches for D-Bus properties.
This commit is contained in:
parent
2e9bea7af6
commit
4e95013040
|
@ -243,6 +243,11 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
|
||||||
const char *interface, const char *member,
|
const char *interface, const char *member,
|
||||||
GDBusSignalFunction function, void *user_data,
|
GDBusSignalFunction function, void *user_data,
|
||||||
GDBusDestroyFunction destroy);
|
GDBusDestroyFunction destroy);
|
||||||
|
guint g_dbus_add_properties_watch(DBusConnection *connection,
|
||||||
|
const char *sender, const char *path,
|
||||||
|
const char *interface,
|
||||||
|
GDBusSignalFunction function, void *user_data,
|
||||||
|
GDBusDestroyFunction destroy);
|
||||||
gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
|
gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
|
||||||
void g_dbus_remove_all_watches(DBusConnection *connection);
|
void g_dbus_remove_all_watches(DBusConnection *connection);
|
||||||
|
|
||||||
|
|
|
@ -752,6 +752,34 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
|
||||||
return cb->id;
|
return cb->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint g_dbus_add_properties_watch(DBusConnection *connection,
|
||||||
|
const char *sender, const char *path,
|
||||||
|
const char *interface,
|
||||||
|
GDBusSignalFunction function, void *user_data,
|
||||||
|
GDBusDestroyFunction destroy)
|
||||||
|
{
|
||||||
|
struct filter_data *data;
|
||||||
|
struct filter_callback *cb;
|
||||||
|
|
||||||
|
data = filter_data_get(connection, signal_filter, sender, path,
|
||||||
|
DBUS_INTERFACE_PROPERTIES, "PropertiesChanged",
|
||||||
|
interface);
|
||||||
|
if (data == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
cb = filter_data_add_callback(data, NULL, NULL, function, destroy,
|
||||||
|
user_data);
|
||||||
|
if (cb == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (data->name != NULL && data->name_watch == 0)
|
||||||
|
data->name_watch = g_dbus_add_service_watch(connection,
|
||||||
|
data->name, NULL,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
|
return cb->id;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean g_dbus_remove_watch(DBusConnection *connection, guint id)
|
gboolean g_dbus_remove_watch(DBusConnection *connection, guint id)
|
||||||
{
|
{
|
||||||
struct filter_data *data;
|
struct filter_data *data;
|
||||||
|
|
Loading…
Reference in New Issue