diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-02-11 20:19:10 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-02-11 20:19:10 +0100 |
commit | 3767c5e9dbe9f789bfb07e856ac7414e8eb41a92 (patch) | |
tree | 4fd80e4b4590652b3a98bf3366259e7622485da7 /gdbus | |
parent | ab34d7b754ffd949cc6693059550df95378d5cf6 (diff) |
gdbus: Don't call property changed callback during client init
When the client uses ObjectManager to init properties, do not call
property changed callbacks. They should only be called once the proxy
added has been successfully signaled since the proxy itself provides
a full copy of available properties.
Diffstat (limited to 'gdbus')
-rw-r--r-- | gdbus/client.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/gdbus/client.c b/gdbus/client.c index c03e3a4c2..0311f9a48 100644 --- a/gdbus/client.c +++ b/gdbus/client.c @@ -201,7 +201,7 @@ static void prop_entry_free(gpointer data) } static void add_property(GDBusProxy *proxy, const char *name, - DBusMessageIter *iter) + DBusMessageIter *iter, gboolean send_changed) { DBusMessageIter value; struct prop_entry *prop; @@ -220,7 +220,7 @@ static void add_property(GDBusProxy *proxy, const char *name, if (proxy->prop_func) proxy->prop_func(proxy, name, &value, proxy->prop_data); - if (client == NULL) + if (client == NULL || send_changed == FALSE) return; if (client->property_changed) @@ -239,7 +239,8 @@ static void add_property(GDBusProxy *proxy, const char *name, proxy->prop_func(proxy, name, &value, proxy->prop_data); } -static void update_properties(GDBusProxy *proxy, DBusMessageIter *iter) +static void update_properties(GDBusProxy *proxy, DBusMessageIter *iter, + gboolean send_changed) { DBusMessageIter dict; @@ -260,7 +261,7 @@ static void update_properties(GDBusProxy *proxy, DBusMessageIter *iter) dbus_message_iter_get_basic(&entry, &name); dbus_message_iter_next(&entry); - add_property(proxy, name, &entry); + add_property(proxy, name, &entry, send_changed); dbus_message_iter_next(&dict); } @@ -283,7 +284,7 @@ static void get_all_properties_reply(DBusPendingCall *call, void *user_data) dbus_message_iter_init(reply, &iter); - update_properties(proxy, &iter); + update_properties(proxy, &iter, FALSE); done: if (g_list_find(client->proxy_list, proxy) == NULL) { @@ -525,7 +526,7 @@ static void refresh_property_reply(DBusPendingCall *call, void *user_data) dbus_message_iter_init(reply, &iter); - add_property(data->proxy, data->name, &iter); + add_property(data->proxy, data->name, &iter, TRUE); } else dbus_error_free(&error); @@ -803,7 +804,7 @@ static void properties_changed(GDBusClient *client, const char *path, if (proxy == NULL) return; - update_properties(proxy, &iter); + update_properties(proxy, &iter, TRUE); dbus_message_iter_next(&iter); @@ -843,7 +844,7 @@ static void parse_properties(GDBusClient *client, const char *path, proxy = proxy_lookup(client, path, interface); if (proxy) { - update_properties(proxy, iter); + update_properties(proxy, iter, FALSE); return; } @@ -851,7 +852,7 @@ static void parse_properties(GDBusClient *client, const char *path, if (proxy == NULL) return; - update_properties(proxy, iter); + update_properties(proxy, iter, FALSE); if (client->proxy_added) client->proxy_added(proxy, client->user_data); |