Merge lp:~aacid/libdbusmenu/do_not_reuse_menuitems_different_type into lp:libdbusmenu/13.04

Proposed by Albert Astals Cid
Status: Merged
Approved by: Charles Kerr
Approved revision: 434
Merged at revision: 432
Proposed branch: lp:~aacid/libdbusmenu/do_not_reuse_menuitems_different_type
Merge into: lp:libdbusmenu/13.04
Diff against target: 35 lines (+23/-2)
1 file modified
libdbusmenu-glib/client.c (+23/-2)
To merge this branch: bzr merge lp:~aacid/libdbusmenu/do_not_reuse_menuitems_different_type
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+131414@code.launchpad.net

Commit message

Do not reuse menu items if their type is different

The gtk side does not know how to convert from a separator to a standard item,
and even if it'd knew it does not make much sense to reuse them since if the types
are different you can expect there's little to reuse

Description of the change

Do not reuse menu items if their type is different

The gtk side does not know how to convert from a separator to a standard item,
and even if it'd knew it does not make much sense to reuse them since if the types
are different you can expect there's little to reuse

To post a comment you must log in.
433. By Albert Astals Cid

Use g_variant_compare

434. By Albert Astals Cid

null type means standard type

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c 2012-10-07 15:35:50 +0000
+++ libdbusmenu-glib/client.c 2012-10-25 15:21:21 +0000
@@ -2160,8 +2160,29 @@
2160 for (childsearch = oldchildren; childsearch != NULL; childsearch = g_list_next(childsearch)) {2160 for (childsearch = oldchildren; childsearch != NULL; childsearch = g_list_next(childsearch)) {
2161 DbusmenuMenuitem * cs_mi = DBUSMENU_MENUITEM(childsearch->data);2161 DbusmenuMenuitem * cs_mi = DBUSMENU_MENUITEM(childsearch->data);
2162 if (childid == dbusmenu_menuitem_get_id(cs_mi)) {2162 if (childid == dbusmenu_menuitem_get_id(cs_mi)) {
2163 oldchildren = g_list_remove(oldchildren, cs_mi);2163 GVariantIter iter;
2164 childmi = cs_mi;2164 gchar * prop;
2165 GVariant * value;
2166 GVariant * child_props;
2167 GVariant * new_type = NULL;
2168 GVariant * old_type = NULL;
2169
2170 child_props = g_variant_get_child_value(child, 1);
2171 g_variant_iter_init(&iter, child_props);
2172 while (g_variant_iter_loop(&iter, "{sv}", &prop, &value)) {
2173 if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) {
2174 new_type = value;
2175 break;
2176 }
2177 }
2178 g_variant_unref(child_props);
2179
2180 old_type = dbusmenu_menuitem_property_get_variant(cs_mi, DBUSMENU_MENUITEM_PROP_TYPE);
2181 if ((old_type == NULL && new_type == NULL) || (old_type != NULL && new_type != NULL && g_variant_compare(old_type, new_type) == 0)) {
2182 // Only recycle the menu item if it's of the same type
2183 oldchildren = g_list_remove(oldchildren, cs_mi);
2184 childmi = cs_mi;
2185 }
2165 break;2186 break;
2166 }2187 }
2167 }2188 }

Subscribers

People subscribed via source and target branches