aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-12-09 16:50:02 -0600
committerTed Gould <ted@gould.cx>2010-12-09 16:50:02 -0600
commit2597a9ea2a74a8390c0f46ea1518d493608aea19 (patch)
tree7825b62bb00da37120524d5aa482c136ea6aba4f /libdbusmenu-gtk
parentb29bfd7c365a6b768dcf4530c40e9220d9e8abd1 (diff)
parent1574d58e111bd80cbeb770ab3f603dca88a90341 (diff)
downloadlibdbusmenu-2597a9ea2a74a8390c0f46ea1518d493608aea19.tar.gz
libdbusmenu-2597a9ea2a74a8390c0f46ea1518d493608aea19.tar.bz2
libdbusmenu-2597a9ea2a74a8390c0f46ea1518d493608aea19.zip
Fixing check menu items (and radio)
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/genericmenuitem.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c
index 61881ef..2af70f3 100644
--- a/libdbusmenu-gtk/genericmenuitem.c
+++ b/libdbusmenu-gtk/genericmenuitem.c
@@ -65,6 +65,7 @@ static void (*parent_draw_indicator) (GtkCheckMenuItem *check_menu_item, cairo_t
static void draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area);
static void (*parent_draw_indicator) (GtkCheckMenuItem *check_menu_item, GdkRectangle *area) = NULL;
#endif
+static void (*parent_menuitem_activate) (GtkMenuItem * mi) = NULL;
/* Initializing all of the classes. Most notably we're
disabling the drawing of the check early. */
@@ -86,6 +87,7 @@ genericmenuitem_class_init (GenericmenuitemClass *klass)
GtkMenuItemClass * menuitem_class = GTK_MENU_ITEM_CLASS (klass);
menuitem_class->set_label = set_label;
menuitem_class->get_label = get_label;
+ parent_menuitem_activate = menuitem_class->activate;
menuitem_class->activate = activate;
return;
@@ -333,21 +335,19 @@ genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state)
item->priv->state = state;
GtkCheckMenuItem * check = GTK_CHECK_MENU_ITEM(item);
-
- gboolean old_active = gtk_check_menu_item_get_active (check);
- gboolean old_inconsist = gtk_check_menu_item_get_inconsistent (check);
+ gboolean goal_active = FALSE;
switch (item->priv->state) {
case GENERICMENUITEM_STATE_UNCHECKED:
- gtk_check_menu_item_set_active (check, FALSE);
+ goal_active = FALSE;
gtk_check_menu_item_set_inconsistent (check, FALSE);
break;
case GENERICMENUITEM_STATE_CHECKED:
- gtk_check_menu_item_set_active (check, TRUE);
+ goal_active = TRUE;
gtk_check_menu_item_set_inconsistent (check, FALSE);
break;
case GENERICMENUITEM_STATE_INDETERMINATE:
- gtk_check_menu_item_set_active (check, TRUE);
+ goal_active = TRUE;
gtk_check_menu_item_set_inconsistent (check, TRUE);
break;
default:
@@ -355,16 +355,12 @@ genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state)
return;
}
- if (old_active != gtk_check_menu_item_get_active (check)) {
- g_object_notify(G_OBJECT(item), "active");
- }
-
- if (old_inconsist != gtk_check_menu_item_get_inconsistent (check)) {
- g_object_notify(G_OBJECT(item), "inconsistent");
+ if (goal_active != gtk_check_menu_item_get_active(check)) {
+ if (parent_menuitem_activate != NULL) {
+ parent_menuitem_activate(GTK_MENU_ITEM(check));
+ }
}
- gtk_widget_queue_draw(GTK_WIDGET(item));
-
return;
}