diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2008-04-28 13:27:25 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2008-04-28 13:27:25 +0000 |
commit | d123a61162eb935eec397d809d1002011d25d145 (patch) | |
tree | 67f795e004bbee6feca825125d4e9789123c6bb5 /gtk/recent.c | |
parent | 8824568b728fc308fcdb7f66d9d385bb76dbe925 (diff) | |
download | wireshark-d123a61162eb935eec397d809d1002011d25d145.tar.gz |
Added flag i new recent file to determine where to get values now
moved to recent_common. This will convert old recent file to new.
svn path=/trunk/; revision=25188
Diffstat (limited to 'gtk/recent.c')
-rw-r--r-- | gtk/recent.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/gtk/recent.c b/gtk/recent.c index fd680b45ab..755e78012b 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -77,6 +77,7 @@ #define RECENT_GUI_GEOMETRY "gui.geom." #define RECENT_KEY_PRIVS_WARN_IF_ELEVATED "privs.warn_if_elevated" #define RECENT_KEY_PRIVS_WARN_IF_NO_NPF "privs.warn_if_no_npf" +#define RECENT_KEY_HAS_RECENT_COMMON "recent.has_recent_common" #define RECENT_FILE_NAME "recent" #define RECENT_COMMON_FILE_NAME "recent_common" @@ -351,6 +352,10 @@ write_profile_recent(void) recent.gui_geometry_main_lower_pane); } + fprintf(rf, "\n# This configuration has a recent_common file.\n"); + fprintf(rf, "# TRUE or FALSE (case-insensitive).\n"); + fprintf(rf, RECENT_KEY_HAS_RECENT_COMMON ": TRUE\n"); + fprintf(rf, "\n# Packet list column pixel widths.\n"); fprintf(rf, "# Each pair of strings consists of a column format and its pixel width.\n"); packet_list_recent_write_all(rf); @@ -587,6 +592,13 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ recent.gui_geometry_main_lower_pane = num; recent.has_gui_geometry_main_lower_pane = TRUE; + } else if (strcmp(key, RECENT_KEY_HAS_RECENT_COMMON) == 0) { + if (g_ascii_strcasecmp(value, "true") == 0) { + recent.has_recent_common = TRUE; + } + else { + recent.has_recent_common = FALSE; + } } else if (strcmp(key, RECENT_KEY_COL_WIDTH) == 0) { col_l = prefs_get_string_list(value); if (col_l == NULL) @@ -733,6 +745,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return) recent.privs_warn_if_elevated = TRUE; recent.privs_warn_if_no_npf = TRUE; + recent.has_recent_common = FALSE; recent.col_width_list = NULL; @@ -803,10 +816,12 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return) /* We succeeded in opening it; read it. */ read_prefs_file(rf_path, rf, read_set_recent_pair_static, NULL); fclose(rf); - /* Read older common settings, in case we come from an older version */ - rf = eth_fopen(rf_path, "r"); - read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL); - fclose(rf); + if (!recent.has_recent_common) { + /* Read older common settings from recent file */ + rf = eth_fopen(rf_path, "r"); + read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL); + fclose(rf); + } g_free(rf_path); rf_path = NULL; } else { @@ -829,7 +844,11 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return) /* Construct the pathname of the user's recent file. */ - rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE); + if (recent.has_recent_common) { + rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE); + } else { + rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE, FALSE); + } /* Read the user's recent file, if it exists. */ *rf_path_return = NULL; |