Add a "file_selection_new()" routine that does all the positioning (GTK+
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 24 Sep 2003 08:43:34 +0000 (08:43 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 24 Sep 2003 08:43:34 +0000 (08:43 +0000)
2.x) and transient-for setting that's done for other dialogs, and use it
for dialogs that come from the main window or from children of the main
window.

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

gtk/capture_dlg.c
gtk/dlg_utils.c
gtk/dlg_utils.h
gtk/file_dlg.c
gtk/print_dlg.c

index 82da60e193bdf60fb27ec0180b6b6d93b78a1838..44680462bf230f947ab8593060842d09fe0a67a5 100644 (file)
@@ -1,7 +1,7 @@
 /* capture_dlg.c
  * Routines for packet capture windows
  *
- * $Id: capture_dlg.c,v 1.83 2003/09/10 07:02:25 guy Exp $
+ * $Id: capture_dlg.c,v 1.84 2003/09/24 08:43:34 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -666,7 +666,7 @@ capture_prep_file_cb(GtkWidget *w, gpointer file_te)
     return;
   }
 
-  fs = gtk_file_selection_new ("Ethereal: Capture File");
+  fs = file_selection_new ("Ethereal: Capture File");
 
   /* If we've opened a file, start out by showing the files in the directory
      in which that file resided. */
index b88476bbc73f7db67372d805885aafba173e0f2a..4149bcc9a65de896faa6b57722703edd016ab9c7 100644 (file)
@@ -1,7 +1,7 @@
 /* dlg_utils.c
  * Utilities to use when constructing dialogs
  *
- * $Id: dlg_utils.c,v 1.11 2003/09/20 04:59:43 guy Exp $
+ * $Id: dlg_utils.c,v 1.12 2003/09/24 08:43:34 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -43,18 +43,33 @@ dlg_key_press (GtkWidget *widget, GdkEventKey *event, gpointer cancel_button);
 GtkWidget *
 dlg_window_new(const gchar *title)
 {
-       GtkWidget *win;
+  GtkWidget *win;
 
 #if GTK_MAJOR_VERSION < 2
-       win = gtk_window_new(GTK_WINDOW_DIALOG);
+  win = gtk_window_new(GTK_WINDOW_DIALOG);
 #else
-       win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
+  win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
 #endif
-       gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
-       gtk_window_set_title(GTK_WINDOW(win), title);
-       SIGNAL_CONNECT(win, "realize", window_icon_realize_cb, NULL);
-       return win;
+  gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
+  gtk_window_set_title(GTK_WINDOW(win), title);
+  SIGNAL_CONNECT(win, "realize", window_icon_realize_cb, NULL);
+  return win;
+}
+
+/* Create a file selection dialog box window that belongs to Ethereal's
+   main window. */
+GtkWidget *
+file_selection_new(const gchar *title)
+{
+  GtkWidget *win;
+
+  win = gtk_file_selection_new(title);
+#if GTK_MAJOR_VERSION >= 2
+  gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
+#endif
+  gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
+  return win;
 }
 
 /* Set the "activate" signal for a widget to call a routine to
index ab8372e2c80d49552d416332b490036481a1075b..200b20d71f2df39b057b504f37b93943702dd3a7 100644 (file)
@@ -1,13 +1,12 @@
 /* dlg_utils.h
  * Declarations of utilities to use when constructing dialogs
  *
- * $Id: dlg_utils.h,v 1.6 2002/08/28 21:03:47 jmayer Exp $
+ * $Id: dlg_utils.h,v 1.7 2003/09/24 08:43:34 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
  *
- *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
 /* Create a dialog box window that belongs to Ethereal's main window. */
 GtkWidget *dlg_window_new(const gchar *);
 
+/* Create a file selection dialog box window that belongs to Ethereal's
+   main window. */
+GtkWidget *file_selection_new(const gchar *);
+
 /* Set the "activate" signal for a widget to call a routine to
    activate the "OK" button for a dialog box. */
 void dlg_set_activate(GtkWidget *widget, GtkWidget *ok_button);
index a18fd0d3d9c5d0874417b5dfcc87eccefa19883e..34813b80569fc8d24fb6a608b9277a9bb9beb3e5 100644 (file)
@@ -1,7 +1,7 @@
 /* file_dlg.c
  * Dialog boxes for handling files
  *
- * $Id: file_dlg.c,v 1.60 2003/09/20 04:59:43 guy Exp $
+ * $Id: file_dlg.c,v 1.61 2003/09/24 08:43:34 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -94,11 +94,7 @@ file_open_cmd_cb(GtkWidget *w, gpointer data _U_)
     return;
   }
 
-  file_open_w = gtk_file_selection_new ("Ethereal: Open Capture File");
-  gtk_window_set_transient_for(GTK_WINDOW(file_open_w), GTK_WINDOW(top_level));
-#if GTK_MAJOR_VERSION >= 2
-  gtk_window_set_position(GTK_WINDOW(file_open_w), GTK_WIN_POS_CENTER_ON_PARENT);
-#endif
+  file_open_w = file_selection_new ("Ethereal: Open Capture File");
   SIGNAL_CONNECT(file_open_w, "destroy", file_open_destroy_cb, NULL);
 
 #if GTK_MAJOR_VERSION < 2
@@ -451,11 +447,7 @@ file_save_as_cmd_cb(GtkWidget *w _U_, gpointer data _U_)
   marked   = FALSE;
   filetype = cfile.cd_t;
 
-  file_save_as_w = gtk_file_selection_new ("Ethereal: Save Capture File As");
-  gtk_window_set_transient_for(GTK_WINDOW(file_save_as_w), GTK_WINDOW(top_level));
-#if GTK_MAJOR_VERSION >= 2
-  gtk_window_set_position(GTK_WINDOW(file_save_as_w), GTK_WIN_POS_CENTER_ON_PARENT);
-#endif
+  file_save_as_w = file_selection_new ("Ethereal: Save Capture File As");
   SIGNAL_CONNECT(file_save_as_w, "destroy", file_save_as_destroy_cb, NULL);
 
   /* If we've opened a file, start out by showing the files in the directory
index 35e106da91d3bf04696f980178577453957e6d8b..7ada0778b4fdb9fc5380e69610f08e719b1d8fba 100644 (file)
@@ -1,7 +1,7 @@
 /* print_dlg.c
  * Dialog boxes for printing
  *
- * $Id: print_dlg.c,v 1.42 2003/09/10 22:23:58 guy Exp $
+ * $Id: print_dlg.c,v 1.43 2003/09/24 08:43:34 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -512,7 +512,7 @@ print_file_cb(GtkWidget *file_bt, gpointer file_te)
     return;
   }
 
-  fs = gtk_file_selection_new ("Ethereal: Print to File");
+  fs = file_selection_new ("Ethereal: Print to File");
 
   /* If we've opened a file, start out by showing the files in the directory
      in which that file resided. */