Rename the tap_dfilter_dlg.[ch] files to reflect that they can do more
[obnox/wireshark/wip.git] / gtk / smb2_stat.c
index 6d8857bdcb13ff76bb1f0a200a9b1e9a054c8464..3a327f30731cd99ac1d132bd5b61150e14ec352a 100644 (file)
@@ -29,7 +29,6 @@
 #ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
-
 #include <string.h>
 
 #include <gtk/gtk.h>
 #include <epan/packet_info.h>
 #include <epan/epan.h>
 #include <epan/value_string.h>
-
 #include <epan/tap.h>
 #include <epan/dissectors/packet-smb2.h>
-#include "../register.h"
+
 #include "../timestats.h"
 #include "../simple_dialog.h"
-#include "gui_utils.h"
-#include "dlg_utils.h"
 #include "../file.h"
 #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"
+
+#include "gtk/gui_utils.h"
+#include "gtk/dlg_utils.h"
+#include "gtk/filter_dlg.h"
+#include "gtk/service_response_time_table.h"
+#include "gtk/tap_param_dlg.h"
+#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
 
 
 /* used to keep track of the statistics for an entire program interface */
@@ -111,8 +111,6 @@ smb2stat_draw(void *pss)
 }
 
 
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
 static void
 win_destroy_cb(GtkWindow *win _U_, gpointer data)
 {
@@ -148,7 +146,8 @@ gtk_smb2stat_init(const char *optarg, void *userdata _U_)
 
        ss=g_malloc(sizeof(smb2stat_t));
 
-       ss->win=window_new(GTK_WINDOW_TOPLEVEL, "smb2-stat");
+       ss->win = dlg_window_new("smb2-stat");  /* transient_for top_level */
+       gtk_window_set_destroy_with_parent (GTK_WINDOW(ss->win), TRUE);
        gtk_window_set_default_size(GTK_WINDOW(ss->win), 550, 400);
        smb2stat_set_title(ss);
 
@@ -173,13 +172,13 @@ gtk_smb2stat_init(const char *optarg, void *userdata _U_)
 
        init_srt_table(&ss->smb2_srt_table, 256, vbox, "smb2.cmd");
        for(i=0;i<256;i++){
-               init_srt_table_row(&ss->smb2_srt_table, i, val_to_str(i, smb2_cmd_vals, "Unknown(0x%02x)"));
+               init_srt_table_row(&ss->smb2_srt_table, i, val_to_str_ext(i, &smb2_cmd_vals_ext, "Unknown(0x%02x)"));
        }
 
 
-       error_string=register_tap_listener("smb2", ss, filter, smb2stat_reset, smb2stat_packet, smb2stat_draw);
+       error_string=register_tap_listener("smb2", ss, filter, 0, smb2stat_reset, smb2stat_packet, smb2stat_draw);
        if(error_string){
-               simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
+               simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
                g_string_free(error_string, TRUE);
                g_free(ss);
                return;
@@ -197,15 +196,22 @@ gtk_smb2stat_init(const char *optarg, void *userdata _U_)
 
        gtk_widget_show_all(ss->win);
        window_present(ss->win);
-       
-       cf_retap_packets(&cfile, FALSE);
+
+       cf_retap_packets(&cfile);
+       gdk_window_raise(ss->win->window);
 }
 
-static tap_dfilter_dlg smb2_stat_dlg = {
+static tap_param smb2_stat_params[] = {
+       { PARAM_FILTER, "Filter", NULL }
+};
+
+static tap_param_dlg smb2_stat_dlg = {
        "SMB2 SRT Statistics",
        "smb2,srt",
        gtk_smb2stat_init,
-       -1
+       -1,
+       G_N_ELEMENTS(smb2_stat_params),
+       smb2_stat_params
 };
 
 void