diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-09-27 15:05:13 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-09-27 15:05:13 +0200 |
commit | 16fe2e5d0525422ba6ca5db9e92a93d17caae302 (patch) | |
tree | d6f1a9ed22335f6d0b457ccdd560b7525fb38d14 /src/utilities/config.vala | |
parent | 10af7615316fd91eef61cc66a8ede38a2bff3fdc (diff) |
Imported Upstream version 0.6.6upstream/0.6.6
Diffstat (limited to 'src/utilities/config.vala')
-rw-r--r-- | src/utilities/config.vala | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/utilities/config.vala b/src/utilities/config.vala index 538602d..5dedddb 100644 --- a/src/utilities/config.vala +++ b/src/utilities/config.vala @@ -161,7 +161,9 @@ public class Config : GLib.Object { load_themes(theme_name); - if (error_occrured) save(); + if (error_occrured) { + save(); + } } ///////////////////////////////////////////////////////////////////// @@ -177,18 +179,19 @@ public class Config : GLib.Object { // load global themes var d = Dir.open(Paths.global_themes); while ((name = d.read_name()) != null) { - var theme = new Theme(Paths.global_themes + "/" + name); + var new_theme = new Theme(Paths.global_themes + "/" + name); - if (theme.load()) - themes.add(theme); + if (new_theme.load()) { + themes.add(new_theme); + } } // load local themes d = Dir.open(Paths.local_themes); while ((name = d.read_name()) != null) { - var theme = new Theme(Paths.local_themes + "/" + name); - if (theme.load()) - themes.add(theme); + var new_theme = new Theme(Paths.local_themes + "/" + name); + if (new_theme.load()) + themes.add(new_theme); } } catch (Error e) { @@ -211,10 +214,26 @@ public class Config : GLib.Object { warning("Theme \"" + current + "\" not found! Using fallback..."); } theme.load_images(); + } else { + error("No theme found!"); } - else error("No theme found!"); } + ///////////////////////////////////////////////////////////////////// + /// Returns true if a loaded theme has the given name or is in a + /// directory with the given name. + ///////////////////////////////////////////////////////////////////// + + public bool has_theme(string name) { + + foreach (var theme in themes) { + if (theme.name == name || theme.directory.has_suffix(name)) { + return true; + } + } + + return false; + } } } |