diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-02-11 23:02:05 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-02-11 23:02:05 +0000 |
commit | 55662a3607e82d369f1a869fb95bea8fcbd6c2bb (patch) | |
tree | 380e05f1802ac696d642e89ff91c3c322fc1a661 | |
parent | cb1f3a809306278708b21551aff3131e3d7709ba (diff) |
Inactivate the "Decode As" menu item if the "Decode As" dialog box
wouldn't actually offer any options to the user.
Make a bunch of routines static that aren't used outside
"decode_as_dlg.c".
Remove the declaration of the nonexistent "decode_as_register_tcpudp()"
routine.
svn path=/trunk/; revision=3020
-rw-r--r-- | gtk/decode_as_dlg.c | 34 | ||||
-rw-r--r-- | gtk/decode_as_dlg.h | 4 | ||||
-rw-r--r-- | gtk/menu.c | 5 |
3 files changed, 28 insertions, 15 deletions
diff --git a/gtk/decode_as_dlg.c b/gtk/decode_as_dlg.c index 70a8d27228..0451130ef3 100644 --- a/gtk/decode_as_dlg.c +++ b/gtk/decode_as_dlg.c @@ -1,6 +1,6 @@ /* decode_as_dlg.c * - * $Id: decode_as_dlg.c,v 1.1 2001/02/01 07:34:33 guy Exp $ + * $Id: decode_as_dlg.c,v 1.2 2001/02/11 23:02:04 guy Exp $ * * Routines to modify dissector tables on the fly. * @@ -221,7 +221,7 @@ GSList *dissector_reset_list = NULL; * * @param user_data Unused. */ -void +static void decode_build_reset_list (gchar *table_name, gpointer key, gpointer value, gpointer user_data) { @@ -244,7 +244,7 @@ decode_build_reset_list (gchar *table_name, gpointer key, * @param w Unknown * @param data Unknown */ -void +static void decode_reset_cb (GtkWidget * w, gpointer data) { dissector_delete_item_t *item; @@ -290,7 +290,7 @@ decode_reset_cb (GtkWidget * w, gpointer data) * @param user_data A pointer to the clist in which this information * should be stored. */ -void +static void decode_build_show_list (gchar *table_name, gpointer key, gpointer value, gpointer user_data) { @@ -534,7 +534,7 @@ decode_change_one_dissector (gchar *s, gchar *table_name, gint selector, * * @param leadin A string to print at the start of each line. */ -void +static void decode_debug (GtkCList *clist, gchar *leadin) { gchar *string, *text[E_CLIST_S_COLUMNS]; @@ -1016,8 +1016,9 @@ typedef struct decode_build_clist_info { * routine, specifying information about the dissector table and where * to store any information generated by this routine. */ -void decode_add_to_clist (gchar *table_name, gpointer key, - gpointer value, gpointer user_data) +static void +decode_add_to_clist (gchar *table_name, gpointer key, + gpointer value, gpointer user_data) { GtkCList *clist; gchar *proto_name, *isold, *isconv; @@ -1068,7 +1069,7 @@ void decode_add_to_clist (gchar *table_name, gpointer key, * @param scrolled_win_p Will be filled in with the address of a newly * created GtkScrolledWindow. */ -void +static void decode_clist_menu_start (GtkWidget *page, GtkCList **clist_p, GtkWidget **scrolled_win_p) { @@ -1106,7 +1107,7 @@ decode_clist_menu_start (GtkWidget *page, GtkCList **clist_p, * * @param clist A pointer the the CList to finish. */ -void +static void decode_clist_menu_finish (GtkCList *clist) { gchar *text[E_CLIST_S_COLUMNS]; @@ -1297,7 +1298,7 @@ decode_add_tcpudp_page (void) * @return gboolean TRUE if this protocol is being decoded as TCP or * UDP. */ -gboolean +static gboolean decode_as_transport_ok (gint ip_protocol) { if ((ip_protocol == IP_PROTO_TCP) || (ip_protocol == IP_PROTO_UDP)) @@ -1317,7 +1318,7 @@ decode_as_transport_ok (gint ip_protocol) * @param GtkWidget * A pointer to the widget in which the notebook * should be installed. */ -void +static void decode_add_notebook (GtkWidget *format_hb) { GtkWidget *notebook, *page, *label; @@ -1453,6 +1454,17 @@ decode_as_cb (GtkWidget * w, gpointer data) gtk_widget_show_all(decode_w); } +/* + * This routine indicates whether we'd actually have any pages in the + * notebook in a "Decode As" dialog box; if there wouldn't be, we + * inactivate the menu item for "Decode As". + */ +gboolean +decode_as_ok(void) +{ + return pi.ethertype || pi.ipproto || decode_as_transport_ok(pi.ipproto); +} + /* * Local Variables: diff --git a/gtk/decode_as_dlg.h b/gtk/decode_as_dlg.h index c71adfa61e..b230c92fff 100644 --- a/gtk/decode_as_dlg.h +++ b/gtk/decode_as_dlg.h @@ -1,6 +1,6 @@ /* decode_as_dlg.c * - * $Id: decode_as_dlg.h,v 1.1 2001/02/01 07:34:33 guy Exp $ + * $Id: decode_as_dlg.h,v 1.2 2001/02/11 23:02:05 guy Exp $ * * Routines to modify dissector tables on the fly. * @@ -28,6 +28,6 @@ void decode_as_cb(GtkWidget *, gpointer); void decode_show_cb(GtkWidget *, gpointer); -void decode_as_register_tcpudp(gint); +gboolean decode_as_ok(void); #endif diff --git a/gtk/menu.c b/gtk/menu.c index 115c2f3d24..443cd06cee 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.48 2001/02/01 07:34:33 guy Exp $ + * $Id: menu.c,v 1.49 2001/02/11 23:02:05 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -394,7 +394,8 @@ set_menus_for_selected_packet(gboolean have_selected_packet) set_menu_sensitivity("/Display/Show Packet In New Window", have_selected_packet); set_menu_sensitivity("/Tools/Follow TCP Stream", have_selected_packet ? (pi.ipproto == 6) : FALSE); - set_menu_sensitivity("/Tools/Decode As...", have_selected_packet); + set_menu_sensitivity("/Tools/Decode As...", + have_selected_packet && decode_as_ok()); set_menu_sensitivity("/Resolve Name", have_selected_packet && !g_resolving_actif); } |