From 1e21e31eb64a32308bb78e2f012ff7389c3b9f86 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 29 Dec 2012 13:42:51 -0800 Subject: gdbus: Update properties on D-Bus client re-connections --- gdbus/client.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'gdbus/client.c') diff --git a/gdbus/client.c b/gdbus/client.c index 4d1970bc..03276f02 100644 --- a/gdbus/client.c +++ b/gdbus/client.c @@ -286,10 +286,12 @@ static void get_all_properties_reply(DBusPendingCall *call, void *user_data) update_properties(proxy, &iter); done: - if (client->proxy_added) - client->proxy_added(proxy, client->user_data); + if (g_list_find(client->proxy_list, proxy) == NULL) { + if (client->proxy_added) + client->proxy_added(proxy, client->user_data); - client->proxy_list = g_list_append(client->proxy_list, proxy); + client->proxy_list = g_list_append(client->proxy_list, proxy); + } dbus_message_unref(reply); @@ -758,6 +760,18 @@ gboolean g_dbus_proxy_set_property_watch(GDBusProxy *proxy, return TRUE; } +static void refresh_properties(GDBusClient *client) +{ + GList *list; + + for (list = g_list_first(client->proxy_list); list; + list = g_list_next(list)) { + GDBusProxy *proxy = list->data; + + get_all_properties(proxy); + } +} + static void properties_changed(GDBusClient *client, const char *path, DBusMessage *msg) { @@ -983,8 +997,10 @@ static void get_managed_objects(GDBusClient *client) DBusMessage *msg; DBusPendingCall *call; - if (!client->proxy_added && !client->proxy_removed) + if (!client->proxy_added && !client->proxy_removed) { + refresh_properties(client); return; + } msg = dbus_message_new_method_call(client->service_name, "/", DBUS_INTERFACE_DBUS ".ObjectManager", @@ -1033,6 +1049,8 @@ static void get_name_owner_reply(DBusPendingCall *call, void *user_data) if (client->connect_func) client->connect_func(client->dbus_conn, client->connect_data); + + get_managed_objects(client); } done: -- cgit v1.2.3