aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/follow_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-03-29 22:40:58 +0000
committerGuy Harris <guy@alum.mit.edu>2004-03-29 22:40:58 +0000
commit29c644691b49c655372aa355f51b4e33eaef7d99 (patch)
tree6719c44647f45c9072ae42483e919cad6d7f6046 /gtk/follow_dlg.c
parent08c04ec97398e122efff4fb3c5145716ed110525 (diff)
Make "file_selection_new()" take as its second argument an
Ethereal-defined indication of the action (open vs. save), regardless of whether we're building for GTK+ >= 2.4 or not; we just ignore the argument in pre-2.4 GTK+. Use "file_selection_new()" rather than #if'ed code to use it or "gtk_file_chooser_dialog_new()" for GTK+ >= 2.4 and "gtk_file_selection_new()" or it for pre-2.4 GTK+. Add a "file_selection_set_current_folder()" routine that does the appropriate thing depending on whether we're GTK+ >= 2.4 or not, and use that rather than #if'ed code to use "gtk_file_chooser_set_current_folder()" or "gtk_file_selection_set_filename()". svn path=/trunk/; revision=10511
Diffstat (limited to 'gtk/follow_dlg.c')
-rw-r--r--gtk/follow_dlg.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c
index 8a9455a907..9df2de190e 100644
--- a/gtk/follow_dlg.c
+++ b/gtk/follow_dlg.c
@@ -1,6 +1,6 @@
/* follow_dlg.c
*
- * $Id: follow_dlg.c,v 1.54 2004/03/27 11:16:58 oabad Exp $
+ * $Id: follow_dlg.c,v 1.55 2004/03/29 22:40:58 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -934,7 +934,10 @@ follow_load_text(follow_info_t *follow_info)
static void
follow_save_as_cmd_cb(GtkWidget *w _U_, gpointer data)
{
- GtkWidget *ok_bt, *new_win;
+#if GTK_MAJOR_VERSION < 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 4)
+ GtkWidget *ok_bt;
+#endif
+ GtkWidget *new_win;
follow_info_t *follow_info = data;
if (follow_info->follow_save_as_w != NULL) {
@@ -943,36 +946,26 @@ follow_save_as_cmd_cb(GtkWidget *w _U_, gpointer data)
return;
}
-#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
new_win = file_selection_new("Ethereal: Save TCP Follow Stream As",
- GTK_FILE_CHOOSER_ACTION_SAVE);
-#else
- new_win = gtk_file_selection_new("Ethereal: Save TCP Follow Stream As");
-#endif
+ FILE_SELECTION_SAVE);
follow_info->follow_save_as_w = new_win;
SIGNAL_CONNECT(new_win, "destroy", follow_save_as_destroy_cb, follow_info);
/* Tuck away the follow_info object into the window */
OBJECT_SET_DATA(new_win, E_FOLLOW_INFO_KEY, follow_info);
-#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
/* If we've opened a file, start out by showing the files in the directory
in which that file resided. */
if (last_open_dir)
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(new_win),
- last_open_dir);
+ file_selection_set_current_folder(new_win, last_open_dir);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
if (gtk_dialog_run(GTK_DIALOG(new_win)) == GTK_RESPONSE_ACCEPT)
{
follow_save_as_ok_cb(new_win, new_win);
}
else gtk_widget_destroy(new_win);
#else
- /* If we've opened a file, start out by showing the files in the directory
- in which that file resided. */
- if (last_open_dir)
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(new_win),
- last_open_dir);
-
/* Connect the ok_button to file_save_as_ok_cb function and pass along a
pointer to the file selection box widget */
ok_bt = GTK_FILE_SELECTION(new_win)->ok_button;
@@ -1015,13 +1008,7 @@ follow_save_as_ok_cb(GtkWidget * w _U_, gpointer fs)
directory, and leave the selection box displayed. */
set_last_open_dir(to_name);
g_free(to_name);
-#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fs),
- last_open_dir);
-#else
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs),
- last_open_dir);
-#endif
+ file_selection_set_current_folder(fs, last_open_dir);
return;
}