From 7608a8982074c0c1c08e6a2885b989eabeab6a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Fri, 25 Jun 2010 18:55:09 +0000 Subject: From Cal Turney via bug 4849: Save the folder path of the last capture selected in the Open dialog in recent. svn path=/trunk/; revision=33322 --- gtk/main.c | 27 ++++++++++++--------------- gtk/recent.c | 2 ++ gtk/recent.h | 1 + 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'gtk') diff --git a/gtk/main.c b/gtk/main.c index c40f62731b..f6da2aee98 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -2241,7 +2241,18 @@ main(int argc, char *argv[]) /* Init the "Open file" dialog directory */ /* (do this after the path settings are processed) */ - set_last_open_dir(get_persdatafile_dir()); + + /* Read the profile dependent (static part) of the recent file. */ + /* Only the static part of it will be read, as we don't have the gui now to fill the */ + /* recent lists which is done in the dynamic part. */ + /* We have to do this already here, so command line parameters can overwrite these values. */ + recent_read_profile_static(&rf_path, &rf_open_errno); + if (rf_path != NULL && rf_open_errno != 0) { + simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, + "Could not open recent file\n\"%s\": %s.", + rf_path, strerror(rf_open_errno)); + } + set_last_open_dir(recent.gui_fileopen_remembered_dir); /* Set getopt index back to initial value, so it will start with the first command line parameter again. Also reset opterr to 1, so that @@ -2407,21 +2418,7 @@ main(int argc, char *argv[]) #endif /* !_WIN32 && G_THREADS_ENABLED && USE_THREADS */ splash_update(RA_CONFIGURATION, NULL, (gpointer)splash_win); - - - /* Read the profile dependent (static part) of the recent file. */ - /* Only the static part of it will be read, as we don't have the gui now to fill the */ - /* recent lists which is done in the dynamic part. */ - /* We have to do this already here, so command line parameters can overwrite these values. */ - recent_read_profile_static(&rf_path, &rf_open_errno); - if (rf_path != NULL && rf_open_errno != 0) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not open recent file\n\"%s\": %s.", - rf_path, strerror(rf_open_errno)); - } - proto_help_init(); - cap_file_init(&cfile); /* Fill in capture options with values from the preferences */ diff --git a/gtk/recent.c b/gtk/recent.c index 54509e3ef4..ada8e273ca 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -722,6 +722,8 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_) recent.col_width_list = g_list_append(recent.col_width_list, cfmt); } prefs_clear_string_list(col_l); + } else if (strcmp(key, RECENT_GUI_FILEOPEN_REMEMBERED_DIR) == 0) { + recent.gui_fileopen_remembered_dir = g_strdup(value); } return PREFS_SET_OK; diff --git a/gtk/recent.h b/gtk/recent.h index c7b58c14f2..788a6ac8da 100644 --- a/gtk/recent.h +++ b/gtk/recent.h @@ -87,6 +87,7 @@ typedef struct recent_settings_tag { gboolean privs_warn_if_elevated; gboolean privs_warn_if_no_npf; GList *col_width_list; /* column widths */ + gchar *gui_fileopen_remembered_dir; /* folder of last capture loaded in File Open dialog */ } recent_settings_t; /** Global recent settings. */ -- cgit v1.2.3