Rename the tap_dfilter_dlg.[ch] files to reflect that they can do more
[obnox/wireshark/wip.git] / gtk / smb2_stat.c
index a38b24d2972a5286aced4d74b05ccbb9025157b2..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 "compat_macros.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 */
@@ -112,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)
 {
@@ -149,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);
 
@@ -174,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;
@@ -193,20 +191,27 @@ gtk_smb2stat_init(const char *optarg, void *userdata _U_)
        close_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE);
        window_set_cancel_button(ss->win, close_bt, window_cancel_button_cb);
 
-       SIGNAL_CONNECT(ss->win, "delete_event", window_delete_event_cb, NULL);
-       SIGNAL_CONNECT(ss->win, "destroy", win_destroy_cb, ss);
+       g_signal_connect(ss->win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
+       g_signal_connect(ss->win, "destroy", G_CALLBACK(win_destroy_cb), ss);
 
        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