diff options
author | Ted Gould <ted@gould.cx> | 2010-12-09 16:36:48 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-12-09 16:36:48 -0600 |
commit | 1574d58e111bd80cbeb770ab3f603dca88a90341 (patch) | |
tree | 40fbc935d3d130824a7e3437647f31fbaea154cc /libdbusmenu-gtk | |
parent | cc7b24b14152407bbaec45924da989bb8692a2c2 (diff) | |
download | libdbusmenu-1574d58e111bd80cbeb770ab3f603dca88a90341.tar.gz libdbusmenu-1574d58e111bd80cbeb770ab3f603dca88a90341.tar.bz2 libdbusmenu-1574d58e111bd80cbeb770ab3f603dca88a90341.zip |
Switching away from using set_activate as that doesn't actually set the value, it just signals, but we're sucking up that signal already so we need to manually create it if we need it, which is the only way to set the active property. Goofy.
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r-- | libdbusmenu-gtk/genericmenuitem.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index d507487..d3023ad 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; @@ -338,21 +340,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: @@ -360,16 +360,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; } |