remove some warnings
[obnox/wireshark/wip.git] / gtk / ansi_map_stat.c
index 5a71cb6cef2c4a7e3f1c6ebaf6cc30936e20dafd..ecd54d3162b8b8eebb4db21c5f82783712566a20 100644 (file)
@@ -7,8 +7,8 @@
  *
  * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
@@ -40,7 +40,9 @@
 #include "epan/packet_info.h"
 #include "epan/epan.h"
 #include "epan/value_string.h"
-#include "tap_menu.h"
+#include <epan/stat_cmd_args.h>
+#include "../stat_menu.h"
+#include "gui_stat_menu.h"
 #include "image/clist_ascend.xpm"
 #include "image/clist_descend.xpm"
 #include "simple_dialog.h"
@@ -51,7 +53,7 @@
 #include "filter_dlg.h"
 #include "compat_macros.h"
 #include <epan/dissectors/packet-ansi_map.h>
-#include "ui_util.h"
+#include "gui_utils.h"
 
 
 typedef struct column_arrows {
@@ -361,26 +363,12 @@ ansi_map_stat_gtk_win_create(
 }
 
 
-/*
- * Never gets called ?
- */
-static void
-ansi_map_stat_gtk_init(
-    char               *optarg)
-{
-    /* does not appear to be called */
-
-    optarg = optarg;
-}
-
-
 static void
 ansi_map_stat_gtk_cb(
     GtkWidget          *w _U_,
     gpointer           d _U_)
 {
     int                        i;
-    char               str[100];
 
 
     /*
@@ -397,8 +385,8 @@ ansi_map_stat_gtk_cb(
     i = 0;
     while (ansi_map_opr_code_strings[i].strptr)
     {
-       g_snprintf(str, 100, "0x%02x", ansi_map_opr_code_strings[i].value);
-       dlg.entries[0] = g_strdup(str);
+       dlg.entries[0] = g_strdup_printf("0x%02x",
+                                        ansi_map_opr_code_strings[i].value);
 
        dlg.entries[1] = g_strdup(ansi_map_opr_code_strings[i].strptr);
 
@@ -414,7 +402,16 @@ ansi_map_stat_gtk_cb(
        i++;
     }
 
-    ansi_map_stat_draw(NULL);
+    ansi_map_stat_draw(&stat);
+}
+
+
+static void
+ansi_map_stat_gtk_init(
+    const char         *optarg _U_,
+    void* userdata _U_ )
+{
+    ansi_map_stat_gtk_cb(NULL, NULL);
 }
 
 
@@ -424,8 +421,6 @@ register_tap_listener_gtkansi_map_stat(void)
     GString            *err_p;
 
 
-    register_tap_listener_cmd_arg("ansi_map,", ansi_map_stat_gtk_init);
-
     memset((void *) &stat, 0, sizeof(ansi_map_stat_t));
 
     err_p =
@@ -442,6 +437,7 @@ register_tap_listener_gtkansi_map_stat(void)
        exit(1);
     }
 
-    register_tap_menu_item("ANSI/MAP Operation", REGISTER_TAP_GROUP_TELEPHONY,
+    register_stat_menu_item("ANSI/MAP Operation", REGISTER_STAT_GROUP_TELEPHONY,
         ansi_map_stat_gtk_cb, NULL, NULL, NULL);
+    register_stat_cmd_arg("ansi_map", ansi_map_stat_gtk_init,NULL);
 }