From 143bfc9f801c84428074312d661f8e08803df83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 20 Aug 2016 15:09:31 +0200 Subject: Imported Upstream version 0.23.5 --- plugins/common/Resources.vala | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'plugins/common/Resources.vala') 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; +} + } -- cgit v1.2.3