From bfe73e3ad7162830c222a5b0d73433a72324baa5 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Tue, 15 Dec 2015 19:47:02 +0100 Subject: Qt: save custom colors in recent_common file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to save colors across sessions for systems other than OSX that do not provide a system wide color picker While we are at it, let's stop reading the recent file twice at startup Bug: 11888 Change-Id: I69ff14d699d8111fe6a8bdac0157fcd115a60c2b Reviewed-on: https://code.wireshark.org/review/12659 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke --- ui/recent.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ui/recent.c') diff --git a/ui/recent.c b/ui/recent.c index 64c6c1ee11..56bc280aef 100644 --- a/ui/recent.c +++ b/ui/recent.c @@ -71,6 +71,7 @@ #define RECENT_GUI_CONVERSATION_TABS "gui.conversation_tabs" #define RECENT_GUI_ENDPOINT_TABS "gui.endpoint_tabs" #define RECENT_GUI_RLC_PDUS_FROM_MAC_FRAMES "gui.rlc_pdus_from_mac_frames" +#define RECENT_GUI_CUSTOM_COLORS "gui.custom_colors" #define RECENT_GUI_GEOMETRY "gui.geom." @@ -588,6 +589,7 @@ write_recent(void) char *pf_dir_path; char *rf_path; FILE *rf; + char *string_list; /* To do: * - Split output lines longer than MAX_VAL_LEN @@ -689,6 +691,12 @@ write_recent(void) window_geom_recent_write_all(rf); + fprintf(rf, "\n# Custom colors.\n"); + fprintf(rf, "# List of custom colors selected in Qt color picker.\n"); + string_list = join_string_list(recent.custom_colors); + fprintf(rf, RECENT_GUI_CUSTOM_COLORS ": %s\n", string_list); + g_free(string_list); + fclose(rf); /* XXX - catch I/O errors (e.g. "ran out of disk space") and return @@ -929,6 +937,8 @@ read_set_recent_common_pair_static(gchar *key, const gchar *value, parse_recent_boolean(value, &recent.privs_warn_if_elevated); } else if (strcmp(key, RECENT_KEY_PRIVS_WARN_IF_NO_NPF) == 0) { parse_recent_boolean(value, &recent.privs_warn_if_no_npf); + } else if (strcmp(key, RECENT_GUI_CUSTOM_COLORS) == 0) { + recent.custom_colors = prefs_get_string_list(value); } return PREFS_SET_OK; -- cgit v1.2.1