From f115e4532c600281bb336922f6008ab2bc1d9996 Mon Sep 17 00:00:00 2001 From: Tony Houghton Date: Fri, 18 Aug 2023 20:32:10 +0100 Subject: [PATCH] Fixed remapping of colourscheme options --- src/configlet.c | 5 ++++- src/optsfile.c | 26 ++++++++++++++++++++++---- src/roxterm.c | 6 ++++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/configlet.c b/src/configlet.c index 1537b8e..4989346 100644 --- a/src/configlet.c +++ b/src/configlet.c @@ -214,15 +214,18 @@ static char *configlet_get_configured_name(ConfigletList *cl) g_return_val_if_fail(optkey, NULL); const char *default_name; + const char *default_value; if (strcmp(cl->family, "Colours")) { default_name = "Default"; } else { default_name = global_options_system_theme_is_dark(NULL) ? "Nocturne" : "GTK"; + g_debug("Getting colour scheme for configlet: key %s, default %s", + optkey, default_name); } return options_lookup_string_with_default(cl->cg->capp.options, optkey, - strcmp(cl->family, "Colours") ? "Default" : "GTK"); + strcmp(cl->family, "Colours") ? "Default" : default_name); } static void configlet_list_build(ConfigletList *cl) diff --git a/src/optsfile.c b/src/optsfile.c index 91693d6..5e30c54 100644 --- a/src/optsfile.c +++ b/src/optsfile.c @@ -369,8 +369,8 @@ char *options_file_lookup_string_with_default( char *result; const char *alt_key = NULL; - if (!strcmp(group_name, "Global") || - g_str_has_prefix(group_name, "Profile")) + if (!strcmp(group_name, "roxterm options") || + !strcmp(group_name, "roxterm profile")) { if (!strcmp(key, "colour_scheme")) { @@ -381,6 +381,7 @@ char *options_file_lookup_string_with_default( "colour_scheme_dark" : "colour_scheme_light"; default_value = global_options_system_theme_is_dark(NULL) ? "Nocturne" : "GTK"; + g_debug("Looking up %s/%s instead of %s", group_name, alt_key, key); } else if (g_str_has_prefix(key, "colour_scheme_")) { @@ -389,16 +390,33 @@ char *options_file_lookup_string_with_default( */ alt_key = key; key = "colour_scheme"; + g_debug("Looking up %s/%s with fallback %s", + group_name, alt_key, key); } } if (alt_key) { result = options_file_do_lookup_string(kf, group_name, alt_key); - if (result) return result; + if (result) + { + g_debug("%s/%s is %s", group_name, alt_key, result); + return result; + } } result = options_file_do_lookup_string(kf, group_name, key); - if (!result) result = g_strdup(default_value); + if (!result) + { + result = g_strdup(default_value); + if (alt_key) + { + g_debug("%s/%s was null, default %s", group_name, key, result); + } + } + else if (alt_key) + { + g_debug("%s/%s fallback is %s", group_name, key, result); + } return result; } diff --git a/src/roxterm.c b/src/roxterm.c index 067ce2b..a3567c1 100644 --- a/src/roxterm.c +++ b/src/roxterm.c @@ -4464,6 +4464,7 @@ static void on_dark_theme_pref_changed(GSettings *gsettings, return; } gboolean prefer_dark = global_options_system_theme_is_dark(gsettings); + g_debug("System theme changed to %s", prefer_dark ? "dark" : "light"); const char *pref_key = prefer_dark ? "colour_scheme_dark" : "colour_scheme_light"; GList *link; @@ -4475,6 +4476,11 @@ static void on_dark_theme_pref_changed(GSettings *gsettings, if (!theme) { theme = global_options_lookup_string(pref_key); + g_debug("Applying global theme: %s", theme); + } + else + { + g_debug("Applying theme from profile: %s", theme); } if (theme) {