diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-09-27 15:07:18 +0200 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-09-27 15:07:18 +0200 | 
| commit | e5da485f77b3b8cd3bc32c13e4497a64a2ad10c3 (patch) | |
| tree | b7351c6674108ea5746d70fdc2ff6c59bdc84595 /src/utilities/config.vala | |
| parent | bbabe0f4e471dd984a1c01353c44d4eb1f336473 (diff) | |
| parent | 16fe2e5d0525422ba6ca5db9e92a93d17caae302 (diff) | |
Merge new upstream release
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; +    }  }  } | 
