some more : try to make read/write not break the build if the return value is not...
[obnox/wireshark/wip.git] / gtk / sctp_error_dlg.c
index ecb8c94ac9357f17cc21cb420449d7d4c3dd7daf..b9f09f1c16f17949e2c00709a1151c2a1475d6c0 100644 (file)
@@ -3,8 +3,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
@@ -31,9 +31,8 @@
 #include "globals.h"
 #include "epan/filesystem.h"
 #include "simple_dialog.h"
-#include "tap_menu.h"
 #include "dlg_utils.h"
-#include "ui_util.h"
+#include "gui_utils.h"
 #include "main.h"
 #include "compat_macros.h"
 
@@ -46,8 +45,6 @@ static GtkWidget *clist = NULL;
 static GList *last_list = NULL;
 static sctp_error_info_t* selected_packet = NULL;/* current selection */
 /*static sctp_assoc_info_t* selected_assoc = NULL; */
-extern GtkWidget *main_display_filter_widget;
-
 
 #define NUM_COLS 3
 
@@ -91,39 +88,30 @@ sctp_error_on_unselect(GtkButton *button _U_, gpointer user_data _U_)
        gtk_clist_unselect_all(GTK_CLIST(clist));
 }
 
-void sctp_error_dlg_update(GList *list)
+static void sctp_error_dlg_update(GList *list)
 {
-GList *ilist=NULL;
-printf("dlg_update\n");
-       if (sctp_error_dlg != NULL) {
-                       gtk_clist_clear(GTK_CLIST(clist));
-printf("vor ilist\n");
-       ilist=list;
-       if (ilist==NULL)
-       printf("=NULL\n");
-       printf("nach ilist\n");
+       GList *ilist=NULL;
+
+       if (sctp_error_dlg != NULL) 
+       {
+               gtk_clist_clear(GTK_CLIST(clist));
+               ilist=list;
 
                while (ilist)
                {
-               printf("while\n");
                        add_to_clist((sctp_error_info_t*)(ilist->data));
                        ilist = g_list_next(ilist);
                }
 
                sctp_error_on_unselect(NULL, NULL);
        }
-printf("vor last_list\n");
        last_list = ilist;
 }
 
 static void
-sctp_error_on_select_row(GtkCList *clist,
-                                            gint row,
-                                            gint column _U_,
-                                            GdkEventButton *event _U_,
-                                            gpointer user_data _U_)
+sctp_error_on_select_row(GtkCList *clist, gint row,gint column _U_, GdkEventButton *event _U_, gpointer user_data _U_)
 {
-selected_packet = gtk_clist_get_row_data(GTK_CLIST(clist), row);
+       selected_packet = gtk_clist_get_row_data(GTK_CLIST(clist), row);
 }
 
 
@@ -141,7 +129,7 @@ sctp_error_on_frame (GtkButton *button _U_, gpointer user_data _U_)
 
 
 static void
-sctp_error_on_close (GtkButton *button _U_, gpointer         user_data _U_)
+sctp_error_on_close (GtkButton *button _U_, gpointer user_data _U_)
 {
        gtk_grab_remove(sctp_error_dlg);
        gtk_widget_destroy(sctp_error_dlg);
@@ -158,13 +146,13 @@ gtk_sctperror_dlg(void)
        GtkWidget *bt_frame;
        GtkWidget *bt_close;
 
-       gchar *titles[NUM_COLS] =  {"Framenumber","Chunk Types", "Info"};
+       const gchar *titles[NUM_COLS] =  {"Framenumber","Chunk Types", "Info"};
        column_arrows *col_arrows;
        GtkStyle *win_style;
        GtkWidget *column_lb;
        int i;
 
-       sctp_error_dlg_w = window_new (GTK_WINDOW_TOPLEVEL, "Ethereal: SCTP Associations");
+       sctp_error_dlg_w = window_new (GTK_WINDOW_TOPLEVEL, "Wireshark: SCTP Associations");
        gtk_window_set_position (GTK_WINDOW (sctp_error_dlg_w), GTK_WIN_POS_CENTER);
        SIGNAL_CONNECT(sctp_error_dlg_w, "destroy", dlg_destroy,NULL);
 
@@ -174,17 +162,6 @@ gtk_sctperror_dlg(void)
        gtk_container_add(GTK_CONTAINER(sctp_error_dlg_w), vbox1);
        gtk_widget_show(vbox1);
 
-/*     sctp_error_dlg_w = gtk_dialog_new();
-       gtk_window_set_title (GTK_WINDOW (sctp_error_dlg_w), "Ethereal: SCTP Malformed Packets");
-
-       dialog_vbox1 = GTK_DIALOG (sctp_error_dlg_w)->vbox;
-       gtk_widget_show (dialog_vbox1);
-
-       vbox1 = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (vbox1);
-       gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox1), 8);*/
-
        scrolledwindow1 = scrolled_window_new (NULL, NULL);
        gtk_widget_show (scrolledwindow1);
        gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);
@@ -239,7 +216,7 @@ gtk_sctperror_dlg(void)
        gtk_widget_show (bt_frame);
        gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_frame);
 
-    bt_close = BUTTON_NEW_FROM_STOCK(GTK_STOCK_CLOSE);
+       bt_close = BUTTON_NEW_FROM_STOCK(GTK_STOCK_CLOSE);
        gtk_widget_show (bt_close);
        gtk_container_add (GTK_CONTAINER (hbuttonbox2), bt_close);
 
@@ -250,52 +227,32 @@ gtk_sctperror_dlg(void)
        SIGNAL_CONNECT(bt_close, "clicked", sctp_error_on_close, NULL);
 
        sctp_error_dlg = sctp_error_dlg_w;
-
-
 }
 
 
 void sctp_error_dlg_show(sctp_assoc_info_t* assoc)
 {
-GList *list;
+       GList *list;
 
-
-       /* selected_assoc=(sctp_assoc_info_t*)get_selected_assoc(); */
        list =assoc->error_info_list;
        if (list != NULL)
        {
-       if (sctp_error_dlg != NULL) {
-               /* There's already a dialog box; reactivate it. */
-               reactivate_window(sctp_error_dlg);
-               /* Another list since last call? */
-               if (list != last_list) {
+               if (sctp_error_dlg != NULL) {
+                       /* There's already a dialog box; reactivate it. */
+                       reactivate_window(sctp_error_dlg);
+                       /* Another list since last call? */
+                       if (list != last_list) {
+                               sctp_error_dlg_update(list);
+                       }
+               }
+               else {
+                       /* Create and show the dialog box */
+                       gtk_sctperror_dlg();
                        sctp_error_dlg_update(list);
                }
        }
-       else {
-               /* Create and show the dialog box */
-               gtk_sctperror_dlg();
-               sctp_error_dlg_update(list);
-       }
-       }
        else
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "No errors found!");
 }
 
-
-/*void sctp_error_start(GtkWidget *w _U_, gpointer data _U_)
-{
-       if (sctp_stat_get_info()->is_registered==FALSE)
-       register_tap_listener_sctp_stat();
-       sctp_stat_scan();
-       sctp_error_dlg_show(sctp_stat_get_info()->error_info_list);
-}*/
-
-/****************************************************************************/
-/*void
-register_tap_listener_sctp_error_dlg(void)
-{
-       register_tap_menu_item("SCTP/Show All Malformed Packets...", REGISTER_TAP_GROUP_NONE,
-           sctp_error_start, NULL, NULL, NULL);
-}*/