summaryrefslogtreecommitdiff
path: root/src/utilities/config.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities/config.vala')
-rw-r--r--src/utilities/config.vala35
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;
+ }
}
}