summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-11-27 12:51:20 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2012-11-30 09:00:12 (GMT)
commit985f37dbec74035b91380d22157645724dada5fc (patch)
treea913b89c25c13cfc0d787cf6006f862c2bd587d6 /gdbus
parent2ac19406bac262098feef0a13b686a103cb2036a (diff)
downloadconnman-985f37dbec74035b91380d22157645724dada5fc.zip
connman-985f37dbec74035b91380d22157645724dada5fc.tar.gz
connman-985f37dbec74035b91380d22157645724dada5fc.tar.bz2
gdbus: Add g_dbus_add_properties_watch function
Convenient function to create watches for D-Bus properties.
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/gdbus.h5
-rw-r--r--gdbus/watch.c28
2 files changed, 33 insertions, 0 deletions
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 6aafc61..dd21f86 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -243,6 +243,11 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
const char *interface, const char *member,
GDBusSignalFunction function, void *user_data,
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);
void g_dbus_remove_all_watches(DBusConnection *connection);
diff --git a/gdbus/watch.c b/gdbus/watch.c
index 1cd1211..9e4f994 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -752,6 +752,34 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
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)
{
struct filter_data *data;