diff options
author | Pierre Mazière <pierre.maziere@gmx.com> | 2020-07-01 23:53:07 +0200 |
---|---|---|
committer | Pierre Mazière <pierre.maziere@gmx.com> | 2020-07-02 09:52:43 +0200 |
commit | 274e69532061d1680b8c738d00a2fefe28734673 (patch) | |
tree | edb27f0dd7324bf10899af2cdf2cb658387fd1d5 /src/config | |
parent | e96678e6a50ecf52babde398b4d6d0ced3c15f7e (diff) | |
download | profani-tty-274e69532061d1680b8c738d00a2fefe28734673.tar.gz |
use '*' to set a default executable
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/preferences.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c index 721ead46..088e91f8 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -537,18 +537,23 @@ prefs_get_string_list_with_option(preference_t pref, gchar *option) char **def = _get_default_string_list(pref); gchar **result = g_key_file_get_locale_string_list(prefs, group, key, option, NULL, NULL); + if (result) { + g_strfreev(def); + return result; + } - if (result == NULL) { - if (def) { - return def; - } else { - g_strfreev(def); - return NULL; - } - } else { + result = g_key_file_get_string_list(prefs, group, key, NULL, NULL); + if (result) { g_strfreev(def); return result; } + + if (def) { + return def; + } else { + g_strfreev(def); + return NULL; + } } void @@ -587,13 +592,21 @@ prefs_set_string_list_with_option(preference_t pref, char *option, const gchar* const char *group = _get_group(pref); const char *key = _get_key(pref); if (values == NULL || *values == NULL){ - g_key_file_set_locale_string_list(prefs, group, key, option, NULL, 0); + if (g_strcmp0(option, "*") == 0) { + g_key_file_set_string_list(prefs, group, key, NULL, 0); + } else { + g_key_file_set_locale_string_list(prefs, group, key, option, NULL, 0); + } } else { guint num_values = 0; while(values[num_values]) { - num_values++; + num_values++; + } + if (g_strcmp0(option, "*") == 0) { + g_key_file_set_string_list(prefs, group, key, values, num_values); + } else { + g_key_file_set_locale_string_list(prefs, group, key, option, values, num_values); } - g_key_file_set_locale_string_list(prefs, group, key, option, values, num_values); } } |