forked from osmocom/wireshark
Add a routine to create a new menu item under "/Tools/Statistics" for
taps. (It has to be called after we've created the main menu, but GUI taps are registered before that so that they can be referred to by command-line arguments, so that routine will only be usable if we have a "register menu item" routine for all GUI taps.) Disable the entire "/Tools/Statistics/MGCP" menu item, not just the "RTD" item under it, if we don't have an "mgcp" tap. svn path=/trunk/; revision=7539
This commit is contained in:
parent
733b96657b
commit
6b0b09b402
41
gtk/menu.c
41
gtk/menu.c
|
@ -1,7 +1,7 @@
|
|||
/* menu.c
|
||||
* Menu routines
|
||||
*
|
||||
* $Id: menu.c,v 1.89 2003/04/22 04:49:17 guy Exp $
|
||||
* $Id: menu.c,v 1.90 2003/04/23 03:13:16 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -437,7 +437,7 @@ menus_init(void) {
|
|||
#endif
|
||||
|
||||
if(!find_tap_id("mgcp")) {
|
||||
set_menu_sensitivity(main_menu_factory, "/Tools/Statistics/MGCP/RTD",
|
||||
set_menu_sensitivity(main_menu_factory, "/Tools/Statistics/MGCP",
|
||||
FALSE);
|
||||
}
|
||||
set_menus_for_captured_packets(FALSE);
|
||||
|
@ -446,6 +446,43 @@ menus_init(void) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a new menu item for a statistical tap.
|
||||
* This must be called after we've created the main menu, so it can't
|
||||
* be called from the routine that registers taps - we have to introduce
|
||||
* another per-tap registration routine.
|
||||
*/
|
||||
void
|
||||
register_tap_menu_item(const char *name, GtkItemFactoryCallback callback)
|
||||
{
|
||||
static const char statspath[] = "/Tools/Statistics/";
|
||||
char *menupath;
|
||||
size_t menupathlen;
|
||||
GtkItemFactoryEntry *entry;
|
||||
|
||||
/*
|
||||
* Construct the main menu path for the menu item.
|
||||
*
|
||||
* "sizeof statspath" includes the trailing '\0', so the sum
|
||||
* of that and the length of "name" is enough to hold a string
|
||||
* containing their concatenation.
|
||||
*/
|
||||
menupathlen = sizeof statspath + strlen(name);
|
||||
menupath = g_malloc(menupathlen);
|
||||
strcpy(menupath, statspath);
|
||||
strcat(menupath, name);
|
||||
|
||||
/*
|
||||
* Construct an item factory entry for the item, and add it to
|
||||
* the main menu.
|
||||
*/
|
||||
entry = g_malloc0(sizeof (GtkItemFactoryEntry));
|
||||
entry->path = menupath;
|
||||
entry->callback = callback;
|
||||
gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Enable/disable menu sensitivity.
|
||||
*/
|
||||
|
|
11
gtk/menu.h
11
gtk/menu.h
|
@ -1,7 +1,7 @@
|
|||
/* menu.h
|
||||
* Menu definitions
|
||||
*
|
||||
* $Id: menu.h,v 1.7 2002/08/28 21:03:48 jmayer Exp $
|
||||
* $Id: menu.h,v 1.8 2003/04/23 03:13:16 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -34,6 +34,15 @@ void get_main_menu (GtkWidget **, GtkAccelGroup **);
|
|||
void set_menu_object_data (gchar *path, gchar *key, gpointer data);
|
||||
gint popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data);
|
||||
|
||||
/*
|
||||
* Add a new menu item for a statistical tap.
|
||||
* This must be called after we've created the main menu, so it can't
|
||||
* be called from the routine that registers taps - we have to introduce
|
||||
* another per-tap registration routine.
|
||||
*/
|
||||
extern void register_tap_menu_item(const char *name,
|
||||
GtkItemFactoryCallback callback);
|
||||
|
||||
extern GtkWidget *popup_menu_object;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue