going to have a standard behaviour of the dialogs
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 22 May 2004 19:56:19 +0000 (19:56 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 22 May 2004 19:56:19 +0000 (19:56 +0000)
(including remebering of the dialog size in recent file).
for a first step, I replaced all window_new() calls from dialogs
into dlg_window_new() ones, and removed all gtk_window_set_position
calls, this should be done in a more generalized way

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10964 f5534014-38df-0310-8fa8-9805f1628bb7

12 files changed:
gtk/color_dlg.c
gtk/dlg_utils.c
gtk/dlg_utils.h
gtk/follow_dlg.c
gtk/gsm_map_summary.c
gtk/h225_counter.c
gtk/help_dlg.c
gtk/io_stat.c
gtk/mgcp_stat.c
gtk/mtp3_summary.c
gtk/rtp_analysis.c
gtk/summary_dlg.c

index 79feb05fc5e0a71b7cf90a92a4382064efafb997..0b7ac8711e9bf89d8f966b9925e8b0225bd5ecec 100644 (file)
@@ -1,7 +1,7 @@
 /* color_dlg.c
  * Definitions for dialog boxes for color filters
  *
- * $Id: color_dlg.c,v 1.47 2004/05/01 17:22:09 obiot Exp $
+ * $Id: color_dlg.c,v 1.48 2004/05/22 19:56:18 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1208,7 +1208,6 @@ edit_color_filter_dialog_new(GtkWidget *color_filters,
     /* dialog window */
     edit_dialog = dlg_window_new ("Ethereal: Edit Color Filter");
     gtk_window_set_default_size(GTK_WINDOW(edit_dialog), 500, -1);  
-    /*  gtk_window_set_position(GTK_WINDOW(edit_dialog), GTK_WIN_POS_MOUSE); */
     OBJECT_SET_DATA(edit_dialog, "edit_dialog", edit_dialog);
     colorf->edit_dialog = edit_dialog;
 
index fba86ccd33c0af16a0b50c502c139d5887d89a62..105a954f337a957a6d6b84b128ae2301f08ebb71 100644 (file)
@@ -1,7 +1,7 @@
 /* dlg_utils.c
  * Utilities to use when constructing dialogs
  *
- * $Id: dlg_utils.c,v 1.30 2004/05/21 00:25:04 ulfl Exp $
+ * $Id: dlg_utils.c,v 1.31 2004/05/22 19:56:18 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -286,16 +286,21 @@ dlg_button_row_new(gchar *stock_id_first, ...)
 }
 
 
-#if GTK_MAJOR_VERSION >= 2
 /* this is called, when a dialog was closed */
-void on_dialog_destroyed(GtkWidget *dialog _U_, gpointer data)
+void on_dialog_destroyed(GtkWidget *dialog _U_, gpointer data _U_)
 {
-    /* bring main window back to front (workaround for a bug in win32 GTK2.x)
-       XXX - do this only on Windows? */
-    gtk_window_present(GTK_WINDOW(data));
-}
+#if GTK_MAJOR_VERSION >= 2
+    if(top_level) {
+        /* bring main window back to front (workaround for a bug in win32 GTK2.x)
+           XXX - do this only on Windows? */
+        gtk_window_present(GTK_WINDOW(top_level));
+    }
 #endif
 
+  /* XXX - saved the size of this dialog */
+  /* currently unclear, how the dialogs should be identified */
+}
+
 
 /* Create a dialog box window that belongs to Ethereal's main window. */
 GtkWidget *
@@ -325,15 +330,36 @@ dlg_window_new(const gchar *title)
   if (top_level) {
     gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
   }
+
+  SIGNAL_CONNECT(win, "destroy", on_dialog_destroyed, win);
+
+  return win;
+}
+
+void
+dlg_window_present(GtkWidget *win, GtkWindowPosition pos)
+{
+
+  /* to stay compatible with GTK1.x, only these three pos values are allowed */
+  g_assert(
+      pos == GTK_WIN_POS_NONE || 
+      pos == GTK_WIN_POS_CENTER || 
+      pos == GTK_WIN_POS_MOUSE);        /* preferred for most dialogs */
+
 #if GTK_MAJOR_VERSION >= 2
-  gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
-  if(top_level)
-    SIGNAL_CONNECT(win, "destroy", on_dialog_destroyed, top_level);
   gtk_window_present(GTK_WINDOW(win));
+
+  if(pos == GTK_WIN_POS_CENTER) {
+    pos = GTK_WIN_POS_CENTER_ON_PARENT;
+  }
 #endif
-  return win;
+  gtk_window_set_position(GTK_WINDOW(win), pos);
+
+  /* XXX - set a previously saved size of this dialog */
+  /* currently unclear, how the dialogs should be identified */
 }
 
+
 /* Create a file selection dialog box window that belongs to Ethereal's
    main window. */
 #if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
index d0e1f1039379aff541082b134d1fbd7de737bb55..151c33a089706de0722f4f330799fbe81c988035 100644 (file)
@@ -1,7 +1,7 @@
 /* dlg_utils.h
  * Declarations of utilities to use when constructing dialogs
  *
- * $Id: dlg_utils.h,v 1.12 2004/03/29 22:55:13 guy Exp $
+ * $Id: dlg_utils.h,v 1.13 2004/05/22 19:56:18 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 /* Create a dialog box window that belongs to Ethereal's main window. */
 extern GtkWidget *dlg_window_new(const gchar *);
 
+/* Show the created dialog box window. */
+/* use  GTK_WIN_POS_CENTER or GTK_WIN_POS_MOUSE only! */
+extern void dlg_window_present(GtkWidget *win, GtkWindowPosition pos);
+
 /* Create a file selection dialog box window that belongs to Ethereal's
    main window. */
 typedef enum {
index 33fd895bd40250bd9cfd382d6f5258a59c6f1d4b..3d81b64bd85f63225b3d901710a9b841f9f87390 100644 (file)
@@ -1,6 +1,6 @@
 /* follow_dlg.c
  *
- * $Id: follow_dlg.c,v 1.58 2004/05/09 10:03:40 guy Exp $
+ * $Id: follow_dlg.c,v 1.59 2004/05/22 19:56:18 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -247,7 +247,7 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_)
        fclose(data_out_file);
 
        /* The data_out_filename file now has all the text that was in the session */
-       streamwindow = window_new(GTK_WINDOW_TOPLEVEL, "Follow TCP stream");
+       streamwindow = dlg_window_new("Follow TCP stream");
 
        /* needed in follow_filter_out_stream(), is there a better way? */
        follow_info->streamwindow = streamwindow;
index cee0d109d63b02ccc85a08b1d58630e069b213fa..486844dc50eafcc89d4a0719ea4653031e319db0 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Modified from summary_dlg.c
  *
- * $Id: gsm_map_summary.c,v 1.1 2004/04/21 17:57:31 guy Exp $
+ * $Id: gsm_map_summary.c,v 1.2 2004/05/22 19:56:18 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -85,7 +85,7 @@ gsm_map_stat_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
   /* initial compututations */
   seconds = summary.stop_time - summary.start_time;
 
-  sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "GSM MAP Statistics: Summary");
+  sum_open_w = dlg_window_new("GSM MAP Statistics: Summary");
 
   /* Container for each row of widgets */
   main_vb = gtk_vbox_new(FALSE, 3);
@@ -257,7 +257,6 @@ gsm_map_stat_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
      been selected. */
   dlg_set_cancel(sum_open_w, close_bt);
 
-  gtk_window_set_position(GTK_WINDOW(sum_open_w), GTK_WIN_POS_MOUSE);
   gtk_widget_show(sum_open_w);
 }
 
index 5d6f4a940b416be4ffa5483c359678f7a0317aee..7c89e3d46266dee5ef1ae2a6564de0b2dc15e78e 100644 (file)
@@ -2,7 +2,7 @@
  * h225 message counter for ethereal
  * Copyright 2003 Lars Roland
  *
- * $Id: h225_counter.c,v 1.18 2004/04/12 08:53:02 ulfl Exp $
+ * $Id: h225_counter.c,v 1.19 2004/05/22 19:56:18 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -523,7 +523,7 @@ gtk_h225counter_init(char *optarg)
 
        h225counter_reset(hs);
 
-       hs->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
+       hs->win=dlg_window_new("Ethereal: H225 counters");
        SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs);
 
        hs->vbox=gtk_vbox_new(FALSE, 3);
index 64764c17eaf7802c7fa60957f16f89844549c200..6c403caac5853219a1b385e77e6da2bef45c1920 100644 (file)
@@ -1,6 +1,6 @@
 /* help_dlg.c
  *
- * $Id: help_dlg.c,v 1.51 2004/05/22 04:25:57 guy Exp $
+ * $Id: help_dlg.c,v 1.52 2004/05/22 19:56:18 ulfl Exp $
  *
  * Laurent Deniel <laurent.deniel@free.fr>
  *
@@ -174,7 +174,7 @@ void help_cb(GtkWidget *w _U_, gpointer data _U_)
     return;
   }
 
-  help_w = window_new(GTK_WINDOW_TOPLEVEL, "Ethereal: Help");
+  help_w = dlg_window_new("Ethereal: Help");
   SIGNAL_CONNECT(help_w, "destroy", help_destroy_cb, NULL);
   /* XXX: improve this, e.g. remember the last window size in a file */
   WIDGET_SET_SIZE(help_w, DEF_WIDTH, DEF_HEIGHT);
@@ -184,7 +184,6 @@ void help_cb(GtkWidget *w _U_, gpointer data _U_)
   main_vb = gtk_vbox_new(FALSE, 1);
   gtk_container_border_width(GTK_CONTAINER(main_vb), 1);
   gtk_container_add(GTK_CONTAINER(help_w), main_vb);
-  gtk_widget_show(main_vb);
 
   /* help topics container */
   help_nb = gtk_notebook_new();
@@ -219,13 +218,10 @@ void help_cb(GtkWidget *w _U_, gpointer data _U_)
   }
   fclose(help_toc_file);
 
-  gtk_widget_show(help_nb);
 
   /* Buttons (only "Ok" for now) */
   bbox = dlg_button_row_new(GTK_STOCK_OK, NULL);
-
   gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 5);
-  gtk_widget_show(bbox);
 
   close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK);
   SIGNAL_CONNECT(close_bt, "clicked", help_close_cb, help_w);
@@ -238,7 +234,8 @@ void help_cb(GtkWidget *w _U_, gpointer data _U_)
      been selected. */
   dlg_set_cancel(help_w, close_bt);
 
-  gtk_widget_show(help_w);
+  gtk_widget_show_all(help_w);
+  dlg_window_present(help_w, GTK_WIN_POS_MOUSE);
 
 } /* help_cb */
 
index a634d38d1774a8468ce02041dc5b765dfb704658..a590967e96f018bcbbb445dc90360b52439c7bab 100644 (file)
@@ -1,7 +1,7 @@
 /* io_stat.c
  * io_stat   2002 Ronnie Sahlberg
  *
- * $Id: io_stat.c,v 1.74 2004/04/17 01:01:22 guy Exp $
+ * $Id: io_stat.c,v 1.75 2004/05/22 19:56:18 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1886,9 +1886,7 @@ init_io_stat_window(io_stat_t *io)
     GtkWidget *bt_close;
 
        /* create the main window */
-       io->window=window_new(GTK_WINDOW_TOPLEVEL, NULL);
-
-       gtk_widget_set_name(io->window, "I/O Statistics");
+       io->window=dlg_window_new("I/O Graphs");
 
        vbox=gtk_vbox_new(FALSE, 0);
        gtk_container_add(GTK_CONTAINER(io->window), vbox);
index 441ac7e9179d04376ba6be965ccd91a4ba749bcf..b9ea9acaa9e8953874f7cb43496b11baf87f058e 100644 (file)
@@ -2,7 +2,7 @@
  * mgcp-statistics for ethereal
  * Copyright 2003 Lars Roland
  *
- * $Id: mgcp_stat.c,v 1.33 2004/03/27 11:13:02 guy Exp $
+ * $Id: mgcp_stat.c,v 1.34 2004/05/22 19:56:19 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -276,7 +276,7 @@ gtk_mgcpstat_init(char *optarg)
 
        mgcpstat_reset(ms);
 
-       ms->win=window_new(GTK_WINDOW_TOPLEVEL, NULL);
+       ms->win=dlg_window_new("MGCP SRT");
        SIGNAL_CONNECT(ms->win, "destroy", win_destroy_cb, ms);
 
        ms->vbox=gtk_vbox_new(FALSE, 0);
index 74e14357cd200617db213b8961c5e5a98de6f992..e339c763fa2535b02ea226395f691e02e6ef0169 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Modified from gsm_map_summary.c
  *
- * $Id: mtp3_summary.c,v 1.1 2004/04/21 17:57:31 guy Exp $
+ * $Id: mtp3_summary.c,v 1.2 2004/05/22 19:56:19 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -258,7 +258,7 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
   /* initial compututations */
   seconds = summary.stop_time - summary.start_time;
 
-  sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "MTP3 Statistics: Summary");
+  sum_open_w = dlg_window_new("MTP3 Statistics: Summary");
 
   /* Container for each row of widgets */
   main_vb = gtk_vbox_new(FALSE, 3);
@@ -435,7 +435,6 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
      been selected. */
   dlg_set_cancel(sum_open_w, close_bt);
 
-  gtk_window_set_position(GTK_WINDOW(sum_open_w), GTK_WIN_POS_MOUSE);
   gtk_widget_show_all(sum_open_w);
 }
 
index d47352e1c1bc885bbfab2ebaafb34050ac952b1e..6235e03bd4827d78e7a738719b3eb14e5f4affbc 100644 (file)
@@ -1,7 +1,7 @@
 /* rtp_analysis.c
  * RTP analysis addition for ethereal
  *
- * $Id: rtp_analysis.c,v 1.40 2004/03/13 12:09:27 ulfl Exp $
+ * $Id: rtp_analysis.c,v 1.41 2004/05/22 19:56:19 ulfl Exp $
  *
  * Copyright 2003, Alcatel Business Systems
  * By Lars Ruoff <lars.ruoff@gmx.net>
@@ -1920,8 +1920,7 @@ void create_rtp_dialog(user_data_t* user_data)
        column_arrows *col_arrows_rev;
        
 
-       window = window_new (GTK_WINDOW_TOPLEVEL, "Ethereal: RTP Stream Analysis");
-       gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
+       window = dlg_window_new("Ethereal: RTP Stream Analysis");
        SIGNAL_CONNECT(window, "destroy", on_destroy, user_data);
 
        /* Container for each row of widgets */
index 579481f763058f0f37d9b9bb59c4a6a53b353d01..c332711fac16887e84b24221eb4ea7a96b166e9e 100644 (file)
@@ -1,7 +1,7 @@
 /* summary_dlg.c
  * Routines for capture file summary window
  *
- * $Id: summary_dlg.c,v 1.31 2004/05/21 08:55:07 ulfl Exp $
+ * $Id: summary_dlg.c,v 1.32 2004/05/22 19:56:19 ulfl Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -312,6 +312,5 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
      been selected. */
   dlg_set_cancel(sum_open_w, close_bt);
 
-  gtk_window_set_position(GTK_WINDOW(sum_open_w), GTK_WIN_POS_MOUSE);
   gtk_widget_show_all(sum_open_w);
 }