summaryrefslogtreecommitdiff
path: root/gdbus/watch.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-11-27 14:51:20 +0200
committerMarcel Holtmann <marcel@holtmann.org>2012-11-30 10:00:12 +0100
commit985f37dbec74035b91380d22157645724dada5fc (patch)
treea913b89c25c13cfc0d787cf6006f862c2bd587d6 /gdbus/watch.c
parent2ac19406bac262098feef0a13b686a103cb2036a (diff)
downloadconnman-985f37dbec74035b91380d22157645724dada5fc.tar.gz
connman-985f37dbec74035b91380d22157645724dada5fc.tar.bz2
connman-985f37dbec74035b91380d22157645724dada5fc.zip
gdbus: Add g_dbus_add_properties_watch function
Convenient function to create watches for D-Bus properties.
Diffstat (limited to 'gdbus/watch.c')
-rw-r--r--gdbus/watch.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdbus/watch.c b/gdbus/watch.c
index 1cd12118..9e4f994a 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;