aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-08-21 11:09:36 +0000
committerGuy Harris <guy@alum.mit.edu>2005-08-21 11:09:36 +0000
commitb3562ac0408af8de775d7a6d29042a98408bdece (patch)
tree5766dc83aebeaeb817c5ee3a7ff525eb31fedc51
parent195c549d1aa01dd7e8e8e48972f2ff814c7770c4 (diff)
"gtk_tap_dfilter_dlg_cb()" is no longer used outside
gtk/tap_dfilter_dlg.c; don't export it. That means that gtk/tap_dfilter_dlg.h is no longer useful; get rid of it. Rename "gtk_tap_dfilter_dlg_cb()" to "tap_dfilter_dlg_cb()", as it's inside GTK+-specific code, so there's no need to distinguish it from non-GTK+ callbacks. Update some comments to reflect the name change and the new API for registering tap_dfilter_dlg stats. Make the AFP and SMB stats use the gtk/tap_dfilter_dlg.c stuff. svn path=/trunk/; revision=15496
-rw-r--r--gtk/Makefile.am1
-rw-r--r--gtk/afp_stat.c127
-rw-r--r--gtk/bootp_stat.c1
-rw-r--r--gtk/dlg_utils.h2
-rw-r--r--gtk/h225_counter.c1
-rw-r--r--gtk/h225_ras_srt.c1
-rw-r--r--gtk/mgcp_stat.c1
-rw-r--r--gtk/sctp_chunk_stat.c1
-rw-r--r--gtk/sip_stat.c1
-rw-r--r--gtk/smb_stat.c127
-rw-r--r--gtk/stats_tree_stat.c1
-rw-r--r--gtk/tap_dfilter_dlg.c10
-rw-r--r--gtk/tap_dfilter_dlg.h36
-rw-r--r--gtk/wsp_stat.c1
-rw-r--r--tap_dfilter_dlg.h12
15 files changed, 35 insertions, 288 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 95d67ff9b3..c880fda4d0 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -95,7 +95,6 @@ noinst_HEADERS = \
stream_prefs.h \
summary_dlg.h \
supported_protos_dlg.h \
- tap_dfilter_dlg.h \
text_page.h \
toolbar.h \
voip_calls.h \
diff --git a/gtk/afp_stat.c b/gtk/afp_stat.c
index 171f0279f9..7580189ea8 100644
--- a/gtk/afp_stat.c
+++ b/gtk/afp_stat.c
@@ -39,9 +39,6 @@
#include <epan/epan.h>
#include <epan/value_string.h>
-#include <epan/stat_cmd_args.h>
-#include "../stat_menu.h"
-#include "gtk_stat_menu.h"
#include <epan/tap.h>
#include <epan/dissectors/packet-afp.h>
#include "../register.h"
@@ -54,6 +51,8 @@
#include "../globals.h"
#include "filter_dlg.h"
#include "service_response_time_table.h"
+#include "../stat_menu.h"
+#include "../tap_dfilter_dlg.h"
#include "gtkglobals.h"
@@ -198,122 +197,16 @@ gtk_afpstat_init(const char *optarg)
cf_retap_packets(&cfile);
}
-
-
-static GtkWidget *dlg=NULL;
-static GtkWidget *filter_entry;
-
-static void
-dlg_destroy_cb(void)
-{
- dlg=NULL;
-}
-
-static void
-afpstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
-{
- GString *str;
- const char *filter;
-
- str = g_string_new("afp,srt");
- filter=gtk_entry_get_text(GTK_ENTRY(filter_entry));
- if(filter[0]!=0){
- g_string_sprintfa(str,",%s", filter);
- }
- gtk_afpstat_init(str->str);
- g_string_free(str, TRUE);
-}
-
-static void
-gtk_afpstat_cb(GtkWidget *w _U_, gpointer d _U_)
-{
- GtkWidget *dlg_box;
- GtkWidget *filter_box, *filter_bt;
- GtkWidget *bbox, *start_button, *cancel_button;
- const char *filter;
- static construct_args_t args = {
- "Service Response Time Statistics Filter",
- TRUE,
- FALSE
- };
-
- /* if the window is already open, bring it to front */
- if(dlg){
- gdk_window_raise(dlg->window);
- return;
- }
-
- dlg=dlg_window_new("Ethereal: Compute AFP SRT statistics");
- gtk_window_set_default_size(GTK_WINDOW(dlg), 300, -1);
-
- dlg_box=gtk_vbox_new(FALSE, 10);
- gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
- gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
- gtk_widget_show(dlg_box);
-
- /* Filter box */
- filter_box=gtk_hbox_new(FALSE, 3);
-
- /* Filter button */
- filter_bt=BUTTON_NEW_FROM_STOCK(ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY);
- SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
- gtk_box_pack_start(GTK_BOX(filter_box), filter_bt, FALSE, TRUE, 0);
- gtk_widget_show(filter_bt);
-
- /* Filter entry */
- filter_entry=gtk_entry_new();
- SIGNAL_CONNECT(filter_entry, "changed", filter_te_syntax_check_cb, NULL);
-
- /* filter prefs dialog */
- OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_entry);
- /* filter prefs dialog */
-
- gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
- filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
- if(filter){
- gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
- }
- gtk_widget_show(filter_entry);
-
- gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
- gtk_widget_show(filter_box);
-
- /* button box */
- bbox = dlg_button_row_new(ETHEREAL_STOCK_CREATE_STAT, GTK_STOCK_CANCEL, NULL);
- gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
- gtk_widget_show(bbox);
-
- start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT);
- SIGNAL_CONNECT_OBJECT(start_button, "clicked",
- afpstat_start_button_clicked, NULL);
-
- cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL);
- window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb);
-
- /* Catch the "activate" signal on the filter text entry, so that
- if the user types Return there, we act as if the "Create Stat"
- button had been selected, as happens if Return is typed if some
- widget that *doesn't* handle the Return key has the input
- focus. */
- dlg_set_activate(filter_entry, start_button);
-
- gtk_widget_grab_default(start_button );
-
- /* Give the initial focus to the "Filter" entry box. */
- gtk_widget_grab_focus(filter_entry);
-
- SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL);
- SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
-
- gtk_widget_show_all(dlg);
- window_present(dlg);
-}
+static tap_dfilter_dlg afp_stat_dlg = {
+ "AFP SRT Statistics",
+ "afp,srt",
+ gtk_afpstat_init,
+ -1
+};
void
register_tap_listener_gtkafpstat(void)
{
- register_stat_cmd_arg("afp,srt", gtk_afpstat_init);
-
- register_stat_menu_item("AFP...", REGISTER_STAT_GROUP_RESPONSE_TIME,
- gtk_afpstat_cb, NULL, NULL, NULL);
+ register_dfilter_stat(&afp_stat_dlg, "AFP",
+ REGISTER_STAT_GROUP_RESPONSE_TIME);
}
diff --git a/gtk/bootp_stat.c b/gtk/bootp_stat.c
index 539682c7f0..dd3ce32fb1 100644
--- a/gtk/bootp_stat.c
+++ b/gtk/bootp_stat.c
@@ -42,7 +42,6 @@
#include "compat_macros.h"
#include "../stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
typedef const char* bootp_info_value_t;
diff --git a/gtk/dlg_utils.h b/gtk/dlg_utils.h
index 71118f7ee6..7c2dc4cbc5 100644
--- a/gtk/dlg_utils.h
+++ b/gtk/dlg_utils.h
@@ -55,7 +55,7 @@
* - "RTP Streams" rtpstream_dlg_create()
* - "Simple Dialog" display_simple_dialog()
* - "Compute SMB SRT statistics" gtk_smbstat_cb()
- * - "Compute ..." gtk_tap_dfilter_dlg_cb()
+ * - "Compute ..." tap_dfilter_dlg_cb()
* - "Tcp Graph" create_drawing_area()
* - "Tcp Graph Control" control_panel_create()
* - "Help for TCP graphing" callback_create_help()
diff --git a/gtk/h225_counter.c b/gtk/h225_counter.c
index b82cb051f7..594198ed74 100644
--- a/gtk/h225_counter.c
+++ b/gtk/h225_counter.c
@@ -50,7 +50,6 @@
#include "../globals.h"
#include "../stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
#include "gui_utils.h"
diff --git a/gtk/h225_ras_srt.c b/gtk/h225_ras_srt.c
index 35cf7eab61..3fac6cd04c 100644
--- a/gtk/h225_ras_srt.c
+++ b/gtk/h225_ras_srt.c
@@ -51,7 +51,6 @@
#include "../globals.h"
#include "../stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
#include "gui_utils.h"
diff --git a/gtk/mgcp_stat.c b/gtk/mgcp_stat.c
index 2d57132fce..07d80b7797 100644
--- a/gtk/mgcp_stat.c
+++ b/gtk/mgcp_stat.c
@@ -51,7 +51,6 @@
#include "../globals.h"
#include "../stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
#include "gui_utils.h"
diff --git a/gtk/sctp_chunk_stat.c b/gtk/sctp_chunk_stat.c
index ea8252dc85..9c36144b6e 100644
--- a/gtk/sctp_chunk_stat.c
+++ b/gtk/sctp_chunk_stat.c
@@ -51,7 +51,6 @@
#include "../globals.h"
#include "../stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
#include "gui_utils.h"
diff --git a/gtk/sip_stat.c b/gtk/sip_stat.c
index 3618a720ce..ff83d4d674 100644
--- a/gtk/sip_stat.c
+++ b/gtk/sip_stat.c
@@ -44,7 +44,6 @@
#include "compat_macros.h"
#include "../stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
#define SUM_STR_MAX 1024
diff --git a/gtk/smb_stat.c b/gtk/smb_stat.c
index 8958af985d..d9d90eca4e 100644
--- a/gtk/smb_stat.c
+++ b/gtk/smb_stat.c
@@ -38,9 +38,6 @@
#include <epan/epan.h>
#include <epan/value_string.h>
-#include <epan/stat_cmd_args.h>
-#include "../stat_menu.h"
-#include "gtk_stat_menu.h"
#include <epan/tap.h>
#include "../smb.h"
#include "../register.h"
@@ -53,6 +50,8 @@
#include "../globals.h"
#include "filter_dlg.h"
#include "service_response_time_table.h"
+#include "../stat_menu.h"
+#include "../tap_dfilter_dlg.h"
#include "gtkglobals.h"
@@ -239,122 +238,16 @@ gtk_smbstat_init(const char *optarg)
cf_retap_packets(&cfile);
}
-
-
-static GtkWidget *dlg=NULL;
-static GtkWidget *filter_entry;
-
-static void
-dlg_destroy_cb(void)
-{
- dlg=NULL;
-}
-
-static void
-smbstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
-{
- GString *str;
- const char *filter;
-
- str = g_string_new("smb,srt");
- filter=gtk_entry_get_text(GTK_ENTRY(filter_entry));
- if(filter[0]!=0){
- g_string_sprintfa(str,",%s", filter);
- }
- gtk_smbstat_init(str->str);
- g_string_free(str, TRUE);
-}
-
-static void
-gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_)
-{
- GtkWidget *dlg_box;
- GtkWidget *filter_box, *filter_bt;
- GtkWidget *bbox, *start_button, *cancel_button;
- const char *filter;
- static construct_args_t args = {
- "Service Response Time Statistics Filter",
- TRUE,
- FALSE
- };
-
- /* if the window is already open, bring it to front */
- if(dlg){
- gdk_window_raise(dlg->window);
- return;
- }
-
- dlg=dlg_window_new("Ethereal: Compute SMB SRT statistics");
- gtk_window_set_default_size(GTK_WINDOW(dlg), 300, -1);
-
- dlg_box=gtk_vbox_new(FALSE, 10);
- gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
- gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
- gtk_widget_show(dlg_box);
-
- /* Filter box */
- filter_box=gtk_hbox_new(FALSE, 3);
-
- /* Filter button */
- filter_bt=BUTTON_NEW_FROM_STOCK(ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY);
- SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
- gtk_box_pack_start(GTK_BOX(filter_box), filter_bt, FALSE, TRUE, 0);
- gtk_widget_show(filter_bt);
-
- /* Filter entry */
- filter_entry=gtk_entry_new();
- SIGNAL_CONNECT(filter_entry, "changed", filter_te_syntax_check_cb, NULL);
-
- /* filter prefs dialog */
- OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_entry);
- /* filter prefs dialog */
-
- gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
- filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
- if(filter){
- gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
- }
- gtk_widget_show(filter_entry);
-
- gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
- gtk_widget_show(filter_box);
-
- /* button box */
- bbox = dlg_button_row_new(ETHEREAL_STOCK_CREATE_STAT, GTK_STOCK_CANCEL, NULL);
- gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
- gtk_widget_show(bbox);
-
- start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT);
- SIGNAL_CONNECT_OBJECT(start_button, "clicked",
- smbstat_start_button_clicked, NULL);
-
- cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL);
- window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb);
-
- /* Catch the "activate" signal on the filter text entry, so that
- if the user types Return there, we act as if the "Create Stat"
- button had been selected, as happens if Return is typed if some
- widget that *doesn't* handle the Return key has the input
- focus. */
- dlg_set_activate(filter_entry, start_button);
-
- gtk_widget_grab_default(start_button );
-
- /* Give the initial focus to the "Filter" entry box. */
- gtk_widget_grab_focus(filter_entry);
-
- SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL);
- SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
-
- gtk_widget_show_all(dlg);
- window_present(dlg);
-}
+static tap_dfilter_dlg smb_stat_dlg = {
+ "SMB SRT Statistics",
+ "smb,srt",
+ gtk_smbstat_init,
+ -1
+};
void
register_tap_listener_gtksmbstat(void)
{
- register_stat_cmd_arg("smb,srt", gtk_smbstat_init);
-
- register_stat_menu_item("SMB...", REGISTER_STAT_GROUP_RESPONSE_TIME,
- gtk_smbstat_cb, NULL, NULL, NULL);
+ register_dfilter_stat(&smb_stat_dlg, "SMB",
+ REGISTER_STAT_GROUP_RESPONSE_TIME);
}
diff --git a/gtk/stats_tree_stat.c b/gtk/stats_tree_stat.c
index 34c5552790..7d9640b8e3 100644
--- a/gtk/stats_tree_stat.c
+++ b/gtk/stats_tree_stat.c
@@ -38,7 +38,6 @@
#include "dlg_utils.h"
#include "compat_macros.h"
#include "../stat_menu.h"
-#include "tap_dfilter_dlg.h"
#include "../tap_dfilter_dlg.h"
struct _st_node_pres {
diff --git a/gtk/tap_dfilter_dlg.c b/gtk/tap_dfilter_dlg.c
index c0298f3999..604688361e 100644
--- a/gtk/tap_dfilter_dlg.c
+++ b/gtk/tap_dfilter_dlg.c
@@ -46,7 +46,6 @@
#include "../stat_menu.h"
#include "gtk_stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
#include "gui_utils.h"
#include "gtkglobals.h"
@@ -63,6 +62,9 @@ static tap_dfilter_dlg_list_item *start_dlg_list=NULL;
static tap_dfilter_dlg_list_item *end_dlg_list=NULL;
static tap_dfilter_dlg_list_item *current_dlg = NULL;
+static void
+tap_dfilter_dlg_cb(GtkWidget *w, gpointer data);
+
/*
* Register a stat that has a display filter dialog.
* We register it both as a command-line stat and a menu item stat.
@@ -80,7 +82,7 @@ register_dfilter_stat(tap_dfilter_dlg *info, const char *name,
* to it.
*/
full_name = g_strdup_printf("%s...", name);
- register_stat_menu_item(full_name, group, gtk_tap_dfilter_dlg_cb, NULL,
+ register_stat_menu_item(full_name, group, tap_dfilter_dlg_cb, NULL,
NULL, info);
g_free(full_name);
}
@@ -125,8 +127,8 @@ tap_dfilter_dlg_start_button_clicked(GtkWidget *item _U_, gpointer dialog_data)
}
-void
-gtk_tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data)
+static void
+tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data)
{
const char *filter;
char *title;
diff --git a/gtk/tap_dfilter_dlg.h b/gtk/tap_dfilter_dlg.h
deleted file mode 100644
index 331d003214..0000000000
--- a/gtk/tap_dfilter_dlg.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* tap_dfilter_dlg.h
- * Header file for display filter dialog used by GTK gui taps
- * Copyright 2003 Lars Roland
- *
- * $Id$
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/** @file
- * Display filter dialog box used by GTK gui taps.
- */
-
-/**
- * Create the filter dialog box.
- *
- * @param widget parent widget (unused)
- * @param data the dfilter tap dialog
- */
-void gtk_tap_dfilter_dlg_cb(GtkWidget *widget, gpointer data);
diff --git a/gtk/wsp_stat.c b/gtk/wsp_stat.c
index c821a81e89..3f1f0c53d5 100644
--- a/gtk/wsp_stat.c
+++ b/gtk/wsp_stat.c
@@ -44,7 +44,6 @@
#include <epan/dissectors/packet-wsp.h>
#include "../stat_menu.h"
#include "../tap_dfilter_dlg.h"
-#include "tap_dfilter_dlg.h"
/* used to keep track of the stats for a specific PDU type*/
typedef struct _wsp_pdu_t {
diff --git a/tap_dfilter_dlg.h b/tap_dfilter_dlg.h
index 5d398fa6de..427502cd82 100644
--- a/tap_dfilter_dlg.h
+++ b/tap_dfilter_dlg.h
@@ -31,20 +31,24 @@
* Initiate it with:
* 1) a title string for the Dialog Window
* 2) the init string, which is the same as the string after "-z" option without
- * the filter string and without the seperating comma.
+ * the filter string and without the separating comma.
* 3) a pointer to the init function of the tap, which will be called when you click
* on the start button in the display filter dialog.
* 4) the index with "-1"
*
- * Within register_tap_menu_yourtap(void), call register_stat_menu_item() with gtk_tap_dfilter_dlg_cb as callback and a pointer
- * to the global tap_dfilter_dlg structure .
+ * Within register_tap_menu_yourtap(void), call register_dfilter_stat()
+ * with a pointer to the tap_dfilter_dlg structure, a string for the
+ * menu item (don't put "..." at the end, register_dfilter_stat() will
+ * add it for you), and the REGISTER_STAT_GROUP_ value for the stat
+ * group to which your stat should belong.
*
* Usage:
*
* tap_dfilter_dlg my_tap_dfilter_dlg = {"My Title", "myproto,mytap", gtk_mytap_init, -1};
*
* register_tap_menu_mytap(void) {
- * register_stat_menu_item(char *menu_string, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(my_tap_dfilter_dlg));
+ * register_dfilter_stat(&my_tap_dfilter_dlg, "My Menu Item",
+ * REGISTER_STAT_GROUP_my_group);
* }
*
* See also: h225_ras_srt.c or h225_counter.c