Initialize recent.gui_fileopen_remembered_dir correctly.

Set last open dir when changing profile.

svn path=/trunk/; revision=33324
This commit is contained in:
Stig Bjørlykke 2010-06-25 19:33:18 +00:00
parent 86d55f9a13
commit 1fdc2a2428
2 changed files with 18 additions and 4 deletions

View File

@ -2253,10 +2253,11 @@ main(int argc, char *argv[])
rf_path, strerror(rf_open_errno));
}
if (test_for_directory(recent.gui_fileopen_remembered_dir) != EISDIR) {
set_last_open_dir(get_persdatafile_dir());
} else {
if (recent.gui_fileopen_remembered_dir &&
test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
set_last_open_dir(recent.gui_fileopen_remembered_dir);
} else {
set_last_open_dir(get_persdatafile_dir());
}
/* Set getopt index back to initial value, so it will start with the
@ -3723,6 +3724,10 @@ void change_configuration_profile (const gchar *profile_name)
"Could not open common recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno));
}
if (recent.gui_fileopen_remembered_dir &&
test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
set_last_open_dir(recent.gui_fileopen_remembered_dir);
}
timestamp_set_type (recent.gui_time_format);
timestamp_set_seconds_type (recent.gui_seconds_format);
color_filters_enable(recent.packet_list_colorize);

View File

@ -723,7 +723,10 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_)
}
prefs_clear_string_list(col_l);
} else if (strcmp(key, RECENT_GUI_FILEOPEN_REMEMBERED_DIR) == 0) {
recent.gui_fileopen_remembered_dir = g_strdup(value);
if (recent.gui_fileopen_remembered_dir) {
g_free (recent.gui_fileopen_remembered_dir);
}
recent.gui_fileopen_remembered_dir = g_strdup(value);
}
return PREFS_SET_OK;
@ -817,6 +820,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
recent.privs_warn_if_no_npf = TRUE;
recent.col_width_list = NULL;
recent.gui_fileopen_remembered_dir = NULL;
/* Construct the pathname of the user's recent common file. */
rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE);
@ -878,6 +882,11 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
free_col_width_info(&recent);
}
if (recent.gui_fileopen_remembered_dir) {
g_free (recent.gui_fileopen_remembered_dir);
recent.gui_fileopen_remembered_dir = NULL;
}
/* Construct the pathname of the user's profile recent file. */
rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, FALSE);