diff options
author | Jörg Frings-Fürst <jff@merkur> | 2014-07-23 11:40:09 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <jff@merkur> | 2014-07-23 11:40:09 +0200 |
commit | 6dbb3a7c8f19291de04fc898cef243164fba1ee6 (patch) | |
tree | 773ada7d8adb1d3e3ffdd39a3c32f6ea116be867 /src/images/icon.vala | |
parent | 4aad8c4dc20299a461cadfce208ef42ea7758c81 (diff) | |
parent | 6edfb34cb3eee958e392a433ae9ac4f240279d09 (diff) |
Merge tag 'upstream/0.5.5'
Upstream version 0.5.5
Diffstat (limited to 'src/images/icon.vala')
-rw-r--r-- | src/images/icon.vala | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/images/icon.vala b/src/images/icon.vala index 42be41f..6dfb53b 100644 --- a/src/images/icon.vala +++ b/src/images/icon.vala @@ -56,11 +56,11 @@ public class Icon : Image { ///////////////////////////////////////////////////////////////////// public Icon(string icon_name, int size) { - var cached = this.cache.get("%s@%u".printf(icon_name, size)); + var cached = Icon.cache.get("%s@%u".printf(icon_name, size)); if (cached == null) { - this.load_file_at_size(this.get_icon_file(icon_name, size), size, size); - this.cache.set("%s@%u".printf(icon_name, size), this.surface); + this.load_file_at_size(Icon.get_icon_file(icon_name, size), size, size); + Icon.cache.set("%s@%u".printf(icon_name, size), this.surface); } else { this.surface = cached; } @@ -105,7 +105,6 @@ public class Icon : Image { return icon_name; warning("Icon \"" + icon_name + "\" not found! Using default icon..."); - icon_name = "stock_unknown"; } @@ -115,14 +114,20 @@ public class Icon : Image { if (result == "") { warning("Icon \"" + icon_name + "\" not found! Using default icon..."); - icon_name = "stock_unknown"; - file = icon_theme.lookup_icon(icon_name, size, 0); - if (file != null) result = file.get_filename(); - } - if (result == "") - warning("Icon \"" + icon_name + "\" not found! Will be ugly..."); + string[] default_icons = {"application-default-icon", "stock_unknown"}; + foreach (var icon in default_icons) { + file = icon_theme.lookup_icon(icon, size, 0); + if (file != null) { + result = file.get_filename(); + break; + } + } + if (result == "") + warning("No default icon found! Will be ugly..."); + } + return result; } } |