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:11:08 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-08-20 15:11:08 +0200
commitcb612a12b952e349b96d427645aaeb55d15f509a (patch)
treef29298f41d2a7ea2a976616243aca64c2c2547ce /plugins/common/Resources.vala
parente7be93745e4a2ff3aa255227bef7b9d3b733aafa (diff)
parent143bfc9f801c84428074312d661f8e08803df83b (diff)
Merge tag 'upstream/0.23.5'
Upstream version 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;
+}
+
}