diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-10-11 11:53:27 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-11-26 12:57:43 +0100 |
commit | 031189ffea24eac1a9e335ab98d4a12d1e536a89 (patch) | |
tree | d25b2db77c3ed275cf937b9b4c3ad72157fed250 /gdbus/object.c | |
parent | c4ec194edeac1abc54116241814dc6034f5bef55 (diff) | |
download | ofono-031189ffea24eac1a9e335ab98d4a12d1e536a89.tar.bz2 |
gdbus: Add support for invalidated properties
If there's a pending property but its exists() callback returns false
the property should be considered invalidated and included in the
relevant list of the PropertiesChanged signal.
Diffstat (limited to 'gdbus/object.c')
-rw-r--r-- | gdbus/object.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gdbus/object.c b/gdbus/object.c index 03d2252c..7acb5635 100644 --- a/gdbus/object.c +++ b/gdbus/object.c @@ -1513,6 +1513,7 @@ static void process_properties_from_interface(struct generic_data *data, GSList *l; DBusMessage *signal; DBusMessageIter iter, dict, array; + GSList *invalidated; if (iface->pending_prop == NULL) return; @@ -1534,21 +1535,33 @@ static void process_properties_from_interface(struct generic_data *data, DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict); + invalidated = NULL; + for (l = iface->pending_prop; l != NULL; l = l->next) { GDBusPropertyTable *p = l->data; if (p->get == NULL) continue; - if (p->exists != NULL && !p->exists(p, iface->user_data)) + if (p->exists != NULL && !p->exists(p, iface->user_data)) { + invalidated = g_slist_prepend(invalidated, p); continue; + } append_property(iface, p, &dict); } dbus_message_iter_close_container(&iter, &dict); + dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &array); + for (l = invalidated; l != NULL; l = g_slist_next(l)) { + GDBusPropertyTable *p = l->data; + + dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING, + &p->name); + } + g_slist_free(invalidated); dbus_message_iter_close_container(&iter, &array); g_dbus_send_message(data->conn, signal); |