aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-09-18 12:52:50 +0200
committerMihai Moldovan <ionic@ionic.de>2023-09-19 17:23:30 +0200
commit273045dc19e23c31f7cf412e56c4acd325c8ef92 (patch)
treeb21d4d87ecb8492a28f29f580070bd36c739e94b /src
parent0f287c93d586f16a7d37829da7c54c0f7e48709d (diff)
downloadarctica-greeter-273045dc19e23c31f7cf412e56c4acd325c8ef92.tar.gz
arctica-greeter-273045dc19e23c31f7cf412e56c4acd325c8ef92.tar.bz2
arctica-greeter-273045dc19e23c31f7cf412e56c4acd325c8ef92.zip
src/settings.vala: refactor (icon) theme setting in a cleaner way.
Diffstat (limited to 'src')
-rw-r--r--src/settings.vala27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/settings.vala b/src/settings.vala
index 5c7c10f..656b52a 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -172,20 +172,31 @@ public class AGSettings : Object
greeter.switch_contrast (value);
var settings = Gtk.Settings.get_default ();
+ var theme_name = "";
+ var icon_theme_name = "";
+
if (value)
{
- debug ("Switching GTK Theme to high contrast theme \"%s\"", AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_THEME_NAME));
- debug ("Switching icon theme to high contrast theme \"%s\"", AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_ICON_THEME_NAME));
- settings.set ("gtk-theme-name", AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_THEME_NAME));
- settings.set ("gtk-icon-theme-name", AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_ICON_THEME_NAME));
+
+ /* FIXME: We need to check for wrong theme names here and handle such flaws gracefully */
+
+ theme_name = AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_THEME_NAME);
+ icon_theme_name = AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_ICON_THEME_NAME);
+ debug ("Switching GTK Theme to high contrast theme \"%s\"", theme_name);
+ debug ("Switching icon theme to high contrast theme \"%s\"", icon_theme_name);
}
else
{
- debug ("Switching GTK Theme to default theme \"%s\"", AGSettings.get_string (AGSettings.KEY_THEME_NAME));
- debug ("Switching icon theme to default icon theme \"%s\"", AGSettings.get_string (AGSettings.KEY_ICON_THEME_NAME));
- settings.set ("gtk-theme-name", AGSettings.get_string (AGSettings.KEY_THEME_NAME));
- settings.set ("gtk-icon-theme-name", AGSettings.get_string (AGSettings.KEY_ICON_THEME_NAME));
+
+ /* FIXME: We need to check for wrong theme names here and handle such flaws gracefully */
+
+ theme_name = AGSettings.get_string (AGSettings.KEY_THEME_NAME);
+ icon_theme_name = AGSettings.get_string (AGSettings.KEY_ICON_THEME_NAME);
+ debug ("Switching GTK Theme to default theme \"%s\"", theme_name);
+ debug ("Switching icon theme to default icon theme \"%s\"", icon_theme_name);
}
+ settings.set ("gtk-theme-name", theme_name);
+ settings.set ("gtk-icon-theme-name", icon_theme_name);
}
}