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:24:49 +0100 |
commit | 1dcb7cd93631d04efa72afcf9ebf6f9768db59e8 (patch) | |
tree | 302b9c5ed3a5fe048a2f89b9ff6de5403ea5706c /gdbus | |
parent | b475cc29272254b2ab71540b2bf0fac57d0b0816 (diff) | |
download | connman-1dcb7cd93631d04efa72afcf9ebf6f9768db59e8.tar.gz connman-1dcb7cd93631d04efa72afcf9ebf6f9768db59e8.tar.bz2 connman-1dcb7cd93631d04efa72afcf9ebf6f9768db59e8.zip |
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 c03e3a4c..0311f9a4 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); |