aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-09 10:34:33 -0600
committerTed Gould <ted@gould.cx>2010-02-09 10:34:33 -0600
commit410b3e76f0c5fe382456e7347d13340a927065bf (patch)
tree40bf7d9a8dc105c0650e28b4349ec00156cbe1fa /libdbusmenu-glib
parent06634b0b3f59891f50c2199b8779a7f957cefd18 (diff)
downloadlibdbusmenu-410b3e76f0c5fe382456e7347d13340a927065bf.tar.gz
libdbusmenu-410b3e76f0c5fe382456e7347d13340a927065bf.tar.bz2
libdbusmenu-410b3e76f0c5fe382456e7347d13340a927065bf.zip
Better error handling. If we can't get the properties, remove all of them.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/client.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 5d7b5b1..c2b9c1f 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -570,19 +570,33 @@ menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError
return;
}
+/* This function is called to refresh the properites on an item that
+ is getting recycled with the update, but we think might have prop
+ changes. */
static void
menuitem_get_properties_replace_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data)
{
+ g_return_if_fail(DBUSMENU_IS_MENUITEM(data));
+ gboolean have_error = FALSE;
+
+ if (error != NULL) {
+ g_warning("Unable to replace properties on %d: %s", dbusmenu_menuitem_get_id(DBUSMENU_MENUITEM(data)), error->message);
+ have_error = TRUE;
+ }
+
GList * current_props = NULL;
for (current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data));
current_props != NULL ; current_props = g_list_next(current_props)) {
- if (g_hash_table_lookup(properties, current_props->data) == NULL) {
+ if (have_error || g_hash_table_lookup(properties, current_props->data) == NULL) {
dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data);
}
}
- menuitem_get_properties_cb(proxy, properties, error, data);
+ if (!have_error) {
+ menuitem_get_properties_cb(proxy, properties, error, data);
+ }
+
return;
}