aboutsummaryrefslogtreecommitdiff
path: root/src/settings.vala
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2022-12-06 05:10:29 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-02-06 08:30:01 +0100
commit33d2f8d0461314c5eeaab2c74b10b545906e1491 (patch)
treeb550428b5d03ff49f8f9b8dab514d63dd64c9766 /src/settings.vala
parent131bcb9889b9eb9b8eeb895f23ae1d53a25aefe8 (diff)
downloadarctica-greeter-33d2f8d0461314c5eeaab2c74b10b545906e1491.tar.gz
arctica-greeter-33d2f8d0461314c5eeaab2c74b10b545906e1491.tar.bz2
arctica-greeter-33d2f8d0461314c5eeaab2c74b10b545906e1491.zip
misc src/: completely rework high contrast mode, add stub for big font mode.
This is a work-in-progress. The reworked high contrast mode adds support for a configurable high contrast GTK theme and changes a lot of widgets to change their color. The big font mode is a stub currently.
Diffstat (limited to 'src/settings.vala')
-rw-r--r--src/settings.vala60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/settings.vala b/src/settings.vala
index 3c50bbc..af753ce 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -31,6 +31,7 @@ public class AGSettings : Object
public const string KEY_SHOW_HOSTNAME = "show-hostname";
public const string KEY_LOGO = "logo";
public const string KEY_THEME_NAME = "theme-name";
+ public const string KEY_HIGH_CONTRAST_THEME_NAME = "high-contrast-theme-name";
public const string KEY_ICON_THEME_NAME = "icon-theme-name";
public const string KEY_FONT_NAME = "font-name";
public const string KEY_XFT_ANTIALIAS = "xft-antialias";
@@ -39,6 +40,7 @@ public class AGSettings : Object
public const string KEY_XFT_RGBA = "xft-rgba";
public const string KEY_ONSCREEN_KEYBOARD = "onscreen-keyboard";
public const string KEY_HIGH_CONTRAST = "high-contrast";
+ public const string KEY_BIG_FONT = "big-font";
public const string KEY_SCREEN_READER = "screen-reader";
public const string KEY_PLAY_READY_SOUND = "play-ready-sound";
public const string KEY_INDICATORS = "indicators";
@@ -51,6 +53,8 @@ public class AGSettings : Object
public const string KEY_TOGGLEBOX_FONT_FGCOLOR = "togglebox-font-fgcolor";
public const string KEY_TOGGLEBOX_BUTTON_BGCOLOR = "togglebox-button-bgcolor";
public const string KEY_ENABLE_HIDPI = "enable-hidpi";
+ public const string KEY_MENUBAR_ALPHA = "menubar-alpha";
+
public static bool get_boolean (string key)
{
@@ -112,7 +116,63 @@ public class AGSettings : Object
}
construct {
+ Gtk.Settings.get_default ().get ("gtk-theme-name", out this.default_theme_name_);
+ /*
+ debug ("Fetched default theme name in construct: %s", this.default_theme_name_);
+ */
+ }
+
+ public bool high_contrast {
+ get {
+ return this.high_contrast_;
+ }
+
+ set {
+ debug ("Called high contrast setter with value %s", value.to_string ());
+ this.high_contrast_ = value;
+
+ /* Also sync back to dconf, so that this state is persistent. */
+ set_boolean (AGSettings.KEY_HIGH_CONTRAST, value);
+
+ var greeter = new ArcticaGreeter ();
+ greeter.switch_contrast (value);
+
+ var settings = Gtk.Settings.get_default ();
+ if (value)
+ {
+ /*
+ debug ("Switching GTK Theme to high contrast theme \"%s\"", AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_THEME_NAME));
+ */
+ settings.set ("gtk-theme-name", AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_THEME_NAME));
+ }
+ else
+ {
+ /*
+ debug ("Switching GTK Theme to default theme \"%s\"", this.default_theme_name_);
+ */
+ settings.set ("gtk-theme-name", this.default_theme_name_);
+ }
+ }
+ }
+
+ public bool big_font {
+ get {
+ return this.big_font_;
+ }
+
+ set {
+ this.big_font_ = value;
+
+ /* Also sync back to dconf, so that this state is persistent. */
+ set_boolean (AGSettings.KEY_BIG_FONT, value);
+
+ var greeter = new ArcticaGreeter ();
+ greeter.switch_font (value);
+ }
}
private const string SCHEMA = "org.ArcticaProject.arctica-greeter";
+ private bool high_contrast_ = AGSettings.get_boolean (AGSettings.KEY_HIGH_CONTRAST);
+ private bool big_font_ = AGSettings.get_boolean (AGSettings.KEY_BIG_FONT);
+ private string default_theme_name_;
}