Hide the "Tools" menu if it has no items .

svn path=/trunk/; revision=19578
This commit is contained in:
Luis Ontanon 2006-10-17 17:52:15 +00:00
parent 5da29805b1
commit 482ded17c6
1 changed files with 17 additions and 1 deletions

View File

@ -368,6 +368,10 @@ conversation_cb(GtkWidget * w, gpointer data _U_, int action)
}
#ifdef HAVE_LUA_5_1
static gboolean have_items_in_tools_menu = FALSE;
#endif
/* main menu */
static GtkItemFactoryEntry menu_items[] =
@ -598,6 +602,9 @@ static GtkItemFactoryEntry menu_items[] =
init_conversation_notebook_cb, 0, WIRESHARK_STOCK_CONVERSATIONS),
ITEM_FACTORY_STOCK_ENTRY("/Statistics/Endpoints", NULL,
init_hostlist_notebook_cb, 0, WIRESHARK_STOCK_ENDPOINTS),
#ifdef HAVE_LUA_5_1
ITEM_FACTORY_ENTRY("/_Tools", NULL, NULL, 0, "<Branch>", NULL),
#endif
ITEM_FACTORY_ENTRY("/_Help", NULL, NULL, 0, "<Branch>", NULL),
ITEM_FACTORY_STOCK_ENTRY("/Help/_Contents", "F1", topic_menu_cb, HELP_CONTENT, GTK_STOCK_HELP),
ITEM_FACTORY_ENTRY("/Help/_Supported Protocols", NULL, supported_cb, 0, NULL, NULL),
@ -825,6 +832,12 @@ menus_init(void) {
main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL, 2);
#ifdef HAVE_LUA_5_1
if (! have_items_in_tools_menu) {
gtk_widget_hide(gtk_item_factory_get_item(main_menu_factory,"/Tools"));
}
#endif
merge_all_tap_menus(tap_menu_tree_root);
/* Initialize enabled/disabled state of menu items */
@ -944,7 +957,10 @@ register_stat_menu_item(
case(REGISTER_STAT_GROUP_NONE): toolspath = "/Statistics/"; break;
case(REGISTER_ANALYZE_GROUP_NONE): toolspath = "/Analyze/"; break;
#ifdef HAVE_LUA_5_1
case(REGISTER_TOOLS_GROUP_NONE): toolspath = "/Tools/"; break;
case(REGISTER_TOOLS_GROUP_NONE):
toolspath = "/Tools/";
have_items_in_tools_menu = TRUE;
break;
#endif
default:
g_assert(!"no such menu group");