aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-09-24 08:43:34 +0000
committerGuy Harris <guy@alum.mit.edu>2003-09-24 08:43:34 +0000
commitd0d3f842bb581b36352dde0064700a6f1146e93e (patch)
tree2ad9db6b32ed7abc2c8ad4b83a7500dc0d962aa7 /gtk
parentd2d2015fe2511a159b096ca6d016a93a0e9b591c (diff)
Add a "file_selection_new()" routine that does all the positioning (GTK+
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. svn path=/trunk/; revision=8531
Diffstat (limited to 'gtk')
-rw-r--r--gtk/capture_dlg.c4
-rw-r--r--gtk/dlg_utils.c33
-rw-r--r--gtk/dlg_utils.h9
-rw-r--r--gtk/file_dlg.c14
-rw-r--r--gtk/print_dlg.c4
5 files changed, 37 insertions, 27 deletions
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index 82da60e193..44680462bf 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -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. */
diff --git a/gtk/dlg_utils.c b/gtk/dlg_utils.c
index b88476bbc7..4149bcc9a6 100644
--- a/gtk/dlg_utils.c
+++ b/gtk/dlg_utils.c
@@ -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
diff --git a/gtk/dlg_utils.h b/gtk/dlg_utils.h
index ab8372e2c8..200b20d71f 100644
--- a/gtk/dlg_utils.h
+++ b/gtk/dlg_utils.h
@@ -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
@@ -29,6 +28,10 @@
/* 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);
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index a18fd0d3d9..34813b8056 100644
--- a/gtk/file_dlg.c
+++ b/gtk/file_dlg.c
@@ -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
diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c
index 35e106da91..7ada0778b4 100644
--- a/gtk/print_dlg.c
+++ b/gtk/print_dlg.c
@@ -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. */