summaryrefslogtreecommitdiff
path: root/plugins/common/Resources.vala
diff options
context:
space:
mode:
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;
+}
+
}