summaryrefslogtreecommitdiff
path: root/plugins/common/Resources.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-08-20 15:09:31 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-08-20 15:09:31 +0200
commit143bfc9f801c84428074312d661f8e08803df83b (patch)
tree59a8a447529bd9ce3807aa8bacef861dc5aafd70 /plugins/common/Resources.vala
parent29a7aef998e975b42401cfa96d1b750d91eadf06 (diff)
Imported Upstream version 0.23.5upstream/0.23.5
Diffstat (limited to 'plugins/common/Resources.vala')
-rw-r--r--plugins/common/Resources.vala22
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/common/Resources.vala b/plugins/common/Resources.vala
index 2bb1cb3..29c7294 100644
--- a/plugins/common/Resources.vala
+++ b/plugins/common/Resources.vala
@@ -6,6 +6,9 @@
namespace Resources {
+[CCode (cname = "PLUGIN_RESOURCE_PATH")]
+public extern const string RESOURCE_PATH;
+
public const string WEBSITE_NAME = _("Visit the Shotwell home page");
public const string WEBSITE_URL = "https://wiki.gnome.org/Apps/Shotwell";
@@ -42,7 +45,7 @@ public Gdk.Pixbuf[]? load_icon_set(GLib.File? icon_file) {
warning("couldn't load icon set from %s.", icon_file.get_path());
}
- if (icon_file != null) {
+ if (icon != null) {
Gdk.Pixbuf[] icon_pixbuf_set = new Gdk.Pixbuf[0];
icon_pixbuf_set += icon;
return icon_pixbuf_set;
@@ -51,4 +54,21 @@ public Gdk.Pixbuf[]? load_icon_set(GLib.File? icon_file) {
return null;
}
+public Gdk.Pixbuf[]? load_from_resource (string resource_path) {
+ Gdk.Pixbuf? icon = null;
+ try {
+ icon = new Gdk.Pixbuf.from_resource (resource_path);
+ } catch (Error error) {
+ warning ("Couldn't load icon set from %s", resource_path);
+ }
+
+ if (icon != null) {
+ Gdk.Pixbuf[] icon_pixbuf_set = new Gdk.Pixbuf[0];
+ icon_pixbuf_set += icon;
+ return icon_pixbuf_set;
+ }
+
+ return null;
+}
+
}