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
1=== modified file 'libdbusmenu-glib/client.c'
2--- libdbusmenu-glib/client.c 2012-10-07 15:35:50 +0000
3+++ libdbusmenu-glib/client.c 2012-10-25 15:21:21 +0000
4@@ -2160,8 +2160,29 @@
5 for (childsearch = oldchildren; childsearch != NULL; childsearch = g_list_next(childsearch)) {
6 DbusmenuMenuitem * cs_mi = DBUSMENU_MENUITEM(childsearch->data);
7 if (childid == dbusmenu_menuitem_get_id(cs_mi)) {
8- oldchildren = g_list_remove(oldchildren, cs_mi);
9- childmi = cs_mi;
10+ GVariantIter iter;
11+ gchar * prop;
12+ GVariant * value;
13+ GVariant * child_props;
14+ GVariant * new_type = NULL;
15+ GVariant * old_type = NULL;
16+
17+ child_props = g_variant_get_child_value(child, 1);
18+ g_variant_iter_init(&iter, child_props);
19+ while (g_variant_iter_loop(&iter, "{sv}", &prop, &value)) {
20+ if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) {
21+ new_type = value;
22+ break;
23+ }
24+ }
25+ g_variant_unref(child_props);
26+
27+ old_type = dbusmenu_menuitem_property_get_variant(cs_mi, DBUSMENU_MENUITEM_PROP_TYPE);
28+ if ((old_type == NULL && new_type == NULL) || (old_type != NULL && new_type != NULL && g_variant_compare(old_type, new_type) == 0)) {
29+ // Only recycle the menu item if it's of the same type
30+ oldchildren = g_list_remove(oldchildren, cs_mi);
31+ childmi = cs_mi;
32+ }
33 break;
34 }
35 }

Subscribers

People subscribed via source and target branches