aboutsummaryrefslogtreecommitdiff
path: root/src/settings.vala
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2023-09-19 15:36:13 +0200
committerMihai Moldovan <ionic@ionic.de>2023-09-19 17:23:30 +0200
commitf2f92d4da533b047174fa9d8a90303003a6c2d51 (patch)
treeb7873da5fa84340aa6829e97fe1a592cf50a248d /src/settings.vala
parentc57a53ea271175876ab86ad4ca7549d5d8e371c2 (diff)
downloadarctica-greeter-f2f92d4da533b047174fa9d8a90303003a6c2d51.tar.gz
arctica-greeter-f2f92d4da533b047174fa9d8a90303003a6c2d51.tar.bz2
arctica-greeter-f2f92d4da533b047174fa9d8a90303003a6c2d51.zip
src/settings.vala: remove default_theme_name_ private variable.
This functionality doesn't make sense, for two reasons: - If we query the gtk-theme-name property before setting anything else, we will certainly get the default theme name. But that is hardcoded in GTK and not exactly secret. It can't be configured directly, only by changing specific macros in GTK's source code and recompiling it. The chances of someone doing that are... very small. Thus, we can also just hardcode "Adwaita" in AG. - If we query the gtk-theme-name property after setting it to a different value... we will fetch the value we just set. That's totally useless. My initial idea was that GTK is doing some input sanitization on the provided theme name and handles an invalid name by falling back to its built-in default and setting the gtk-theme-name property to this built-in default as well. This, however, is not true. Setting an invalid theme name will just mean that GTK will fail loading the new theme and stay on whatever theme it was before, copying the new value to the gtk-theme-name property regardless. Unfortunately, querying the property is not something we could use for error handling, which makes it completely useless. It's better to just get rid of this.
Diffstat (limited to 'src/settings.vala')
-rw-r--r--src/settings.vala20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/settings.vala b/src/settings.vala
index 67154e9..5c7c10f 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -141,10 +141,19 @@ 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_);
- */
+ * This function is currently empty, but we'll keep it around,
+ * including this comment, because it's important to know what to do
+ * with it if it's needed.
+ *
+ * Since AGSettings is a SingleInstance class, this function will only
+ * be called once, as long as we make sure to create an instance early
+ * in the program cycle and keep a reference to it for the rest of its
+ * execution.
+ *
+ * In case you need to execute code once, whenever the first AGSettings
+ * instance is created, do it here.
+ */
}
public bool high_contrast {
@@ -172,9 +181,9 @@ public class AGSettings : Object
}
else
{
- debug ("Switching GTK Theme to default theme \"%s\"", this.default_theme_name_);
+ 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", this.default_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));
}
}
@@ -199,5 +208,4 @@ public class AGSettings : Object
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_;
}