Merge lp:~ted/libdbusmenu/check-item-fix into lp:libdbusmenu/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: 175
Proposed branch: lp:~ted/libdbusmenu/check-item-fix
Merge into: lp:libdbusmenu/0.5
Diff against target: 66 lines (+11/-15)
1 file modified
libdbusmenu-gtk/genericmenuitem.c (+11/-15)
To merge this branch: bzr merge lp:~ted/libdbusmenu/check-item-fix
Reviewer Review Type Date Requested Status
DBus Menu Team Pending
Review via email: mp+43304@code.launchpad.net

Description of the change

Fixing check items.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-gtk/genericmenuitem.c'
2--- libdbusmenu-gtk/genericmenuitem.c 2010-12-02 19:52:54 +0000
3+++ libdbusmenu-gtk/genericmenuitem.c 2010-12-09 22:49:53 +0000
4@@ -65,6 +65,7 @@
5 static void draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area);
6 static void (*parent_draw_indicator) (GtkCheckMenuItem *check_menu_item, GdkRectangle *area) = NULL;
7 #endif
8+static void (*parent_menuitem_activate) (GtkMenuItem * mi) = NULL;
9
10 /* Initializing all of the classes. Most notably we're
11 disabling the drawing of the check early. */
12@@ -86,6 +87,7 @@
13 GtkMenuItemClass * menuitem_class = GTK_MENU_ITEM_CLASS (klass);
14 menuitem_class->set_label = set_label;
15 menuitem_class->get_label = get_label;
16+ parent_menuitem_activate = menuitem_class->activate;
17 menuitem_class->activate = activate;
18
19 return;
20@@ -333,21 +335,19 @@
21 item->priv->state = state;
22
23 GtkCheckMenuItem * check = GTK_CHECK_MENU_ITEM(item);
24-
25- gboolean old_active = gtk_check_menu_item_get_active (check);
26- gboolean old_inconsist = gtk_check_menu_item_get_inconsistent (check);
27+ gboolean goal_active = FALSE;
28
29 switch (item->priv->state) {
30 case GENERICMENUITEM_STATE_UNCHECKED:
31- gtk_check_menu_item_set_active (check, FALSE);
32+ goal_active = FALSE;
33 gtk_check_menu_item_set_inconsistent (check, FALSE);
34 break;
35 case GENERICMENUITEM_STATE_CHECKED:
36- gtk_check_menu_item_set_active (check, TRUE);
37+ goal_active = TRUE;
38 gtk_check_menu_item_set_inconsistent (check, FALSE);
39 break;
40 case GENERICMENUITEM_STATE_INDETERMINATE:
41- gtk_check_menu_item_set_active (check, TRUE);
42+ goal_active = TRUE;
43 gtk_check_menu_item_set_inconsistent (check, TRUE);
44 break;
45 default:
46@@ -355,15 +355,11 @@
47 return;
48 }
49
50- if (old_active != gtk_check_menu_item_get_active (check)) {
51- g_object_notify(G_OBJECT(item), "active");
52- }
53-
54- if (old_inconsist != gtk_check_menu_item_get_inconsistent (check)) {
55- g_object_notify(G_OBJECT(item), "inconsistent");
56- }
57-
58- gtk_widget_queue_draw(GTK_WIDGET(item));
59+ if (goal_active != gtk_check_menu_item_get_active(check)) {
60+ if (parent_menuitem_activate != NULL) {
61+ parent_menuitem_activate(GTK_MENU_ITEM(check));
62+ }
63+ }
64
65 return;
66 }

Subscribers

People subscribed via source and target branches