diff options
-rw-r--r-- | libdbusmenu-glib/client.c | 25 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.c | 6 |
2 files changed, 28 insertions, 3 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 237697c..4bb3217 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -2160,8 +2160,29 @@ parse_layout_xml(DbusmenuClient * client, GVariant * layout, DbusmenuMenuitem * for (childsearch = oldchildren; childsearch != NULL; childsearch = g_list_next(childsearch)) { DbusmenuMenuitem * cs_mi = DBUSMENU_MENUITEM(childsearch->data); if (childid == dbusmenu_menuitem_get_id(cs_mi)) { - oldchildren = g_list_remove(oldchildren, cs_mi); - childmi = cs_mi; + GVariantIter iter; + gchar * prop; + GVariant * value; + GVariant * child_props; + GVariant * new_type = NULL; + GVariant * old_type = NULL; + + child_props = g_variant_get_child_value(child, 1); + g_variant_iter_init(&iter, child_props); + while (g_variant_iter_loop(&iter, "{sv}", &prop, &value)) { + if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) { + new_type = value; + break; + } + } + g_variant_unref(child_props); + + old_type = dbusmenu_menuitem_property_get_variant(cs_mi, DBUSMENU_MENUITEM_PROP_TYPE); + if ((old_type == NULL && new_type == NULL) || (old_type != NULL && new_type != NULL && g_variant_compare(old_type, new_type) == 0)) { + // Only recycle the menu item if it's of the same type + oldchildren = g_list_remove(oldchildren, cs_mi); + childmi = cs_mi; + } break; } } diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index d16209a..c33aaf3 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -1180,7 +1180,11 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant /* If we have an image already built from a name that is way better than a pixbuf. Keep it. */ if (gtkimage != NULL && (gtk_image_get_storage_type(GTK_IMAGE(gtkimage)) == GTK_IMAGE_ICON_NAME || gtk_image_get_storage_type(GTK_IMAGE(gtkimage)) == GTK_IMAGE_EMPTY)) { - return; + const gchar *icon_name = NULL; + gtk_image_get_icon_name (GTK_IMAGE(gtkimage), &icon_name, NULL); + if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), icon_name)) { + return; + } } } |