aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-23 10:48:52 -0500
committerTed Gould <ted@gould.cx>2011-03-23 10:48:52 -0500
commitd6db0878e84ee8e290cdbb6431986fcc79928861 (patch)
tree594aa92d9456269c0003ba189f6fed51715a432d /libdbusmenu-glib
parent2916c6939b6eee45dc5876d6f06cfba2b8635163 (diff)
parentf3616aa2137f519baf175649fafd2f83ae169830 (diff)
downloadlibdbusmenu-d6db0878e84ee8e290cdbb6431986fcc79928861.tar.gz
libdbusmenu-d6db0878e84ee8e290cdbb6431986fcc79928861.tar.bz2
libdbusmenu-d6db0878e84ee8e290cdbb6431986fcc79928861.zip
Ensure that we don't remove properties that are getting their values updated
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/client.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 20b91f1..24d5c5d 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -1366,9 +1366,30 @@ menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpoin
have_error = TRUE;
}
+ /* Get the list of the current properties */
GList * current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data));
GList * tmp = NULL;
+ if (properties != NULL) {
+ GVariantIter iter;
+ g_variant_iter_init(&iter, properties);
+ gchar * name; GVariant * value;
+
+ /* Remove the entries from the current list that we have new
+ values for. This way we don't create signals of them being
+ removed with the duplication of the value being changed. */
+ while (g_variant_iter_loop(&iter, "{sv}", &name, &value) && have_error == FALSE) {
+ for (tmp = current_props; tmp != NULL; tmp = g_list_next(tmp)) {
+ if (g_strcmp0((gchar *)tmp->data, name) == 0) {
+ current_props = g_list_delete_link(current_props, tmp);
+ break;
+ }
+ }
+ }
+ }
+
+ /* Remove all entries that we're not getting values for, we can
+ assume that they no longer exist */
for (tmp = current_props; tmp != NULL && have_error == FALSE; tmp = g_list_next(tmp)) {
dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)tmp->data);
}