diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-04-22 04:02:49 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-04-22 04:02:49 +0000 |
commit | 3a4644bf421cbfb5276b61fd22d02c49ef649006 (patch) | |
tree | 021eaa74c0500f942a321addde9e943edeb7e143 /gtk | |
parent | 5b8500241e64cfac5963e22cac6f67a211187e05 (diff) |
"gtk_item_factory_get_widget()" returns, for a menu item with a submenu,
the submenu widget, not the menu item widget. For items with submenus,
set the sensitivity on the menu item widget, not the submenu widget, so
that the menu item is grayed out when not sensitive.
svn path=/trunk/; revision=7522
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/menu.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gtk/menu.c b/gtk/menu.c index 7cd660276e..e94d2010d8 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.87 2003/04/22 00:16:58 guy Exp $ + * $Id: menu.c,v 1.88 2003/04/22 04:02:49 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -453,7 +453,7 @@ static void set_menu_sensitivity(GtkItemFactory *ifactory, gchar *path, gint val) { GSList *menu_list; - GtkWidget *menu; + GtkWidget *menu_item; if (ifactory == NULL) { /* @@ -466,8 +466,21 @@ set_menu_sensitivity(GtkItemFactory *ifactory, gchar *path, gint val) /* * Do it for that particular menu. */ - if ((menu = gtk_item_factory_get_widget(ifactory, path)) != NULL) - gtk_widget_set_sensitive(menu, val); + if ((menu_item = gtk_item_factory_get_widget(ifactory, path)) != NULL) { + if (GTK_IS_MENU(menu_item)) { + /* + * "path" refers to a submenu; "gtk_item_factory_get_widget()" + * gets the menu, not the item that, when selected, pops up + * the submenu. + * + * We have to change the latter item's sensitivity, so that + * it shows up normally if sensitive and grayed-out if + * insensitive. + */ + menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item)); + } + gtk_widget_set_sensitive(menu_item, val); + } } } |