summaryrefslogtreecommitdiff
path: root/src/config/GSettingsEngine.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/GSettingsEngine.vala')
-rw-r--r--src/config/GSettingsEngine.vala35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/config/GSettingsEngine.vala b/src/config/GSettingsEngine.vala
index 89116a7..a3d4e04 100644
--- a/src/config/GSettingsEngine.vala
+++ b/src/config/GSettingsEngine.vala
@@ -25,12 +25,13 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private string[] schema_names;
private string[] key_names;
+ private Gee.HashMap<string, Settings> settings_cache = new Gee.HashMap<string, Settings>();
public GSettingsConfigurationEngine() {
schema_names = new string[ConfigurableProperty.NUM_PROPERTIES];
schema_names[ConfigurableProperty.AUTO_IMPORT_FROM_LIBRARY] = FILES_PREFS_SCHEMA_NAME;
- schema_names[ConfigurableProperty.BG_COLOR_NAME] = UI_PREFS_SCHEMA_NAME;
+ schema_names[ConfigurableProperty.GTK_THEME_VARIANT] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.TRANSPARENT_BACKGROUND_TYPE] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.TRANSPARENT_BACKGROUND_COLOR] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.COMMIT_METADATA_TO_MASTERS] = FILES_PREFS_SCHEMA_NAME;
@@ -104,7 +105,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
key_names = new string[ConfigurableProperty.NUM_PROPERTIES];
key_names[ConfigurableProperty.AUTO_IMPORT_FROM_LIBRARY] = "auto-import";
- key_names[ConfigurableProperty.BG_COLOR_NAME] = "background-color";
+ key_names[ConfigurableProperty.GTK_THEME_VARIANT] = "use-dark-theme";
key_names[ConfigurableProperty.TRANSPARENT_BACKGROUND_TYPE] = "transparent-background-type";
key_names[ConfigurableProperty.TRANSPARENT_BACKGROUND_COLOR] = "transparent-background-color";
key_names[ConfigurableProperty.COMMIT_METADATA_TO_MASTERS] = "commit-metadata";
@@ -176,6 +177,14 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
key_names[ConfigurableProperty.VIDEO_INTERPRETER_STATE_COOKIE] = "interpreter-state-cookie";
}
+ private Settings get_settings(string schema) {
+ if (!this.settings_cache.has_key(schema)) {
+ this.settings_cache[schema] = new Settings(schema);
+ }
+
+ return this.settings_cache[schema];
+ }
+
private void check_key_valid(string schema, string key) throws ConfigurationError {
var schema_source = SettingsSchemaSource.get_default ();
var settings_scheme = schema_source.lookup (schema, true);
@@ -191,7 +200,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private bool get_gs_bool(string schema, string key) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
return schema_object.get_boolean(key);
}
@@ -199,7 +208,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private void set_gs_bool(string schema, string key, bool value) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
schema_object.set_boolean(key, value);
}
@@ -207,21 +216,21 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private void set_gs_enum (string schema, string key, int value) throws ConfigurationError {
check_key_valid (schema, key);
- var schema_object = new Settings (schema);
+ var schema_object = get_settings (schema);
schema_object.set_enum (key, value);
}
private int get_gs_enum (string schema, string key) throws ConfigurationError {
check_key_valid (schema, key);
- var schema_object = new Settings (schema);
+ var schema_object = get_settings (schema);
return schema_object.get_enum (key);
}
private int get_gs_int(string schema, string key) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
return schema_object.get_int(key);
}
@@ -229,7 +238,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private void set_gs_int(string schema, string key, int value) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
schema_object.set_int(key, value);
}
@@ -237,7 +246,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private double get_gs_double(string schema, string key) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
return schema_object.get_double(key);
}
@@ -245,7 +254,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private void set_gs_double(string schema, string key, double value) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
schema_object.set_double(key, value);
}
@@ -253,7 +262,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private string get_gs_string(string schema, string key) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
return schema_object.get_string(key);
}
@@ -261,7 +270,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private void set_gs_string(string schema, string key, string value) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
schema_object.set_string(key, value);
}
@@ -269,7 +278,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
private void reset_gs_to_default(string schema, string key) throws ConfigurationError {
check_key_valid(schema, key);
- Settings schema_object = new Settings(schema);
+ Settings schema_object = get_settings(schema);
schema_object.reset(key);
}