aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/file_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-10-14 23:20:17 +0000
committerGuy Harris <guy@alum.mit.edu>2003-10-14 23:20:17 +0000
commitffa3ad8ef5e25ea4ea39e3f6cf8bee050ef0e87a (patch)
treeb24965e884a58b7294db3dbbe98413390d4ebbe2 /gtk/file_dlg.c
parent2956d71a7b6cb56c49b04fffc58f6f335da1c21d (diff)
From Ian Schorr:
Add a preference to control whether the "File > Open" dialog box should start out in the last directory in which it looked - and save that in the preferences file across invocations - or should always start out in a user-specified directory, and add another preference to specify that directory. Write out section name comments into the preferences file. Clean up white space a bit. svn path=/trunk/; revision=8699
Diffstat (limited to 'gtk/file_dlg.c')
-rw-r--r--gtk/file_dlg.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index 34813b8056..be9858308a 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.61 2003/09/24 08:43:34 guy Exp $
+ * $Id: file_dlg.c,v 1.62 2003/10/14 23:20:17 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -105,11 +105,34 @@ file_open_cmd_cb(GtkWidget *w, gpointer data _U_)
gtk_window_add_accel_group(GTK_WINDOW(file_open_w), accel_group);
#endif
- /* 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(file_open_w), last_open_dir);
-
+ /* If the user has specified that we should always start out in a
+ specified directory, and has specified a directory that we should
+ always look in instead of in that directory, start out
+ by showing the files in that dir. */
+ if (prefs.gui_fileopen_style == FO_STYLE_SPECIFIED &&
+ prefs.gui_fileopen_dir[0] != '\0') {
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_open_w),
+ prefs.gui_fileopen_dir);
+ }
+ else {
+ /* Otherwise, check to see if we've already opened a file.
+ If so, start out by showing the files in the directory in which that
+ file resided. Otherwise, if the user has specified that we should
+ remember the last directory in which we opened a file, use the
+ directory saved in the prefs file (if one was there). */
+ if (last_open_dir) {
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_open_w),
+ last_open_dir);
+ }
+ else {
+ if (prefs.gui_fileopen_style == FO_STYLE_LAST_OPENED &&
+ prefs.gui_fileopen_remembered_dir != NULL) {
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_open_w),
+ prefs.gui_fileopen_remembered_dir);
+ }
+ }
+ }
+
/* Container for each row of widgets */
main_vb = gtk_vbox_new(FALSE, 3);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);