summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2013-02-07 10:22:57 -0600
committerMarcel Holtmann <marcel@holtmann.org>2013-02-15 01:02:44 +0100
commitab100ee868f8550ccd63893be2eb622c400bbfe2 (patch)
treeca25310a9716e5aa74a2ac268373975cce663de4 /gdbus
parent9e343d47650b23a02ffb420b91abac6212dc1d7a (diff)
downloadconnman-ab100ee868f8550ccd63893be2eb622c400bbfe2.tar.gz
connman-ab100ee868f8550ccd63893be2eb622c400bbfe2.tar.bz2
connman-ab100ee868f8550ccd63893be2eb622c400bbfe2.zip
gdbus: Add g_dbus_proxy_set_removed_watch
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/client.c17
-rw-r--r--gdbus/gdbus.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/gdbus/client.c b/gdbus/client.c
index 0311f9a4..369e3acf 100644
--- a/gdbus/client.c
+++ b/gdbus/client.c
@@ -62,6 +62,8 @@ struct GDBusProxy {
char *match_rule;
GDBusPropertyFunction prop_func;
void *prop_data;
+ GDBusProxyFunction removed_func;
+ void *removed_data;
};
struct prop_entry {
@@ -394,6 +396,9 @@ static void proxy_free(gpointer data)
proxy->client = NULL;
}
+ if (proxy->removed_func)
+ proxy->removed_func(proxy, proxy->removed_data);
+
g_dbus_proxy_unref(proxy);
}
@@ -761,6 +766,18 @@ gboolean g_dbus_proxy_set_property_watch(GDBusProxy *proxy,
return TRUE;
}
+gboolean g_dbus_proxy_set_removed_watch(GDBusProxy *proxy,
+ GDBusProxyFunction function, void *user_data)
+{
+ if (proxy == NULL)
+ return FALSE;
+
+ proxy->removed_func = function;
+ proxy->removed_data = user_data;
+
+ return TRUE;
+}
+
static void refresh_properties(GDBusClient *client)
{
GList *list;
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 6f5a0121..8b133939 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -341,6 +341,9 @@ typedef void (* GDBusPropertyFunction) (GDBusProxy *proxy, const char *name,
gboolean g_dbus_proxy_set_property_watch(GDBusProxy *proxy,
GDBusPropertyFunction function, void *user_data);
+gboolean g_dbus_proxy_set_removed_watch(GDBusProxy *proxy,
+ GDBusProxyFunction destroy, void *user_data);
+
GDBusClient *g_dbus_client_new(DBusConnection *connection,
const char *service, const char *path);