diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-09-23 09:36:45 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-09-23 09:36:45 +0200 |
commit | 566dc060676b41e1e58a446b7dcc4159e242fee6 (patch) | |
tree | 6eaeba1cf78d3f03b8a1d5bfa998eb104ca47425 /src/config | |
parent | 4ea2cc3bd4a7d9b1c54a9d33e6a1cf82e7c8c21d (diff) |
Imported Upstream version 0.20.0upstream/0.20.0
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/ConfigurationInterfaces.vala | 32 | ||||
-rw-r--r-- | src/config/GSettingsEngine.vala | 10 |
2 files changed, 40 insertions, 2 deletions
diff --git a/src/config/ConfigurationInterfaces.vala b/src/config/ConfigurationInterfaces.vala index 97f41cc..42a591a 100644 --- a/src/config/ConfigurationInterfaces.vala +++ b/src/config/ConfigurationInterfaces.vala @@ -25,6 +25,8 @@ public enum ConfigurableProperty { COMMIT_METADATA_TO_MASTERS, DESKTOP_BACKGROUND_FILE, DESKTOP_BACKGROUND_MODE, + SCREENSAVER_FILE, + SCREENSAVER_MODE, DIRECTORY_PATTERN, DIRECTORY_PATTERN_CUSTOM, DIRECT_WINDOW_HEIGHT, @@ -101,6 +103,12 @@ public enum ConfigurableProperty { case DESKTOP_BACKGROUND_MODE: return "DESKTOP_BACKGROUND_MODE"; + case SCREENSAVER_FILE: + return "SCREENSAVER_FILE"; + + case SCREENSAVER_MODE: + return "SCREENSAVER_MODE"; + case DIRECTORY_PATTERN: return "DIRECTORY_PATTERN"; @@ -461,6 +469,30 @@ public abstract class ConfigurationFacade : Object { } // + // screensaver background + // + public virtual string get_screensaver() { + try { + return get_engine().get_string_property(ConfigurableProperty.SCREENSAVER_FILE); + } catch (ConfigurationError err) { + on_configuration_error(err); + + return ""; + } + } + + public virtual void set_screensaver(string filename) { + try { + get_engine().set_string_property(ConfigurableProperty.SCREENSAVER_FILE, + filename); + get_engine().set_string_property(ConfigurableProperty.SCREENSAVER_MODE, + "zoom"); + } catch (ConfigurationError err) { + on_configuration_error(err); + } + } + + // // directory pattern // public virtual string? get_directory_pattern() { diff --git a/src/config/GSettingsEngine.vala b/src/config/GSettingsEngine.vala index 3a55648..0b2e691 100644 --- a/src/config/GSettingsEngine.vala +++ b/src/config/GSettingsEngine.vala @@ -18,6 +18,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object { private const string IMPORTING_SCHEMA_NAME = ROOT_SCHEMA_NAME + ".dataimports"; private const string CROP_SCHEMA_NAME = ROOT_SCHEMA_NAME + ".crop-settings"; private const string SYSTEM_DESKTOP_SCHEMA_NAME = "org.gnome.desktop.background"; + private const string SYSTEM_SCREENSAVER_SCHEMA_NAME = "org.gnome.desktop.screensaver"; private const string PLUGINS_ENABLE_DISABLE_SCHEMA_NAME = ROOT_SCHEMA_NAME + ".plugins.enable-state"; @@ -38,6 +39,8 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object { schema_names[ConfigurableProperty.COMMIT_METADATA_TO_MASTERS] = FILES_PREFS_SCHEMA_NAME; schema_names[ConfigurableProperty.DESKTOP_BACKGROUND_FILE] = SYSTEM_DESKTOP_SCHEMA_NAME; schema_names[ConfigurableProperty.DESKTOP_BACKGROUND_MODE] = SYSTEM_DESKTOP_SCHEMA_NAME; + schema_names[ConfigurableProperty.SCREENSAVER_FILE] = SYSTEM_SCREENSAVER_SCHEMA_NAME; + schema_names[ConfigurableProperty.SCREENSAVER_MODE] = SYSTEM_SCREENSAVER_SCHEMA_NAME; schema_names[ConfigurableProperty.DIRECTORY_PATTERN] = FILES_PREFS_SCHEMA_NAME; schema_names[ConfigurableProperty.DIRECTORY_PATTERN_CUSTOM] = FILES_PREFS_SCHEMA_NAME; schema_names[ConfigurableProperty.DIRECT_WINDOW_HEIGHT] = WINDOW_PREFS_SCHEMA_NAME; @@ -101,6 +104,8 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object { key_names[ConfigurableProperty.COMMIT_METADATA_TO_MASTERS] = "commit-metadata"; key_names[ConfigurableProperty.DESKTOP_BACKGROUND_FILE] = "picture-uri"; key_names[ConfigurableProperty.DESKTOP_BACKGROUND_MODE] = "picture-options"; + key_names[ConfigurableProperty.SCREENSAVER_FILE] = "picture-uri"; + key_names[ConfigurableProperty.SCREENSAVER_MODE] = "picture-options"; key_names[ConfigurableProperty.DIRECTORY_PATTERN] = "directory-pattern"; key_names[ConfigurableProperty.DIRECTORY_PATTERN_CUSTOM] = "directory-pattern-custom"; key_names[ConfigurableProperty.DIRECT_WINDOW_HEIGHT] = "direct-height"; @@ -308,9 +313,10 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object { } public void set_string_property(ConfigurableProperty p, string val) throws ConfigurationError { - // if we're setting the desktop background file, convert the filename into a file URI + // if we're setting the desktop background/screensaver file, convert the filename into a file URI string converted_val = val; - if (p == ConfigurableProperty.DESKTOP_BACKGROUND_FILE) { + if (p == ConfigurableProperty.DESKTOP_BACKGROUND_FILE + || p == ConfigurableProperty.SCREENSAVER_FILE) { converted_val = "file://" + val; } |