aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-12-29 13:42:51 -0800
committerMarcel Holtmann <marcel@holtmann.org>2012-12-29 14:50:04 -0800
commit76c3ec8d09c58091ac307727a51bd817a8e46aa8 (patch)
tree73a7e8f1156865cc038d556822b4a2d5576266b1
parent460e886d98ab97e99c2c5afbf6cb68d59aa5053b (diff)
downloadpacrunner-76c3ec8d09c58091ac307727a51bd817a8e46aa8.tar.gz
gdbus: Update properties on D-Bus client re-connections
-rw-r--r--gdbus/client.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gdbus/client.c b/gdbus/client.c
index 4d1970b..03276f0 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: