← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 175: Fixing check menu items (and radio)

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/check-item-fix/+merge/43304
  proposed by: Ted Gould (ted)
------------------------------------------------------------
revno: 175 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-12-09 16:50:02 -0600
message:
  Fixing check menu items (and radio)
modified:
  libdbusmenu-gtk/genericmenuitem.c


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-gtk/genericmenuitem.c'
--- libdbusmenu-gtk/genericmenuitem.c	2010-12-02 19:52:54 +0000
+++ libdbusmenu-gtk/genericmenuitem.c	2010-12-09 22:50:02 +0000
@@ -65,6 +65,7 @@
 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 @@
 	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 @@
 	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,15 +355,11 @@
 		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");
-	}
-
-	gtk_widget_queue_draw(GTK_WIDGET(item));
+	if (goal_active != gtk_check_menu_item_get_active(check)) {
+		if (parent_menuitem_activate != NULL) {
+			parent_menuitem_activate(GTK_MENU_ITEM(check));
+		}
+	}
 
 	return;
 }