[shotwell] import: Load icon from resource



commit 23ad562bef8f3b85bb901e5cea78cf389a1695d3
Author: Jens Georg <mail jensge org>
Date:   Tue Jul 19 23:36:08 2016 +0200

    import: Load icon from resource
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747368

 import.am                                          |    9 ++++++++-
 plugins/shotwell-data-imports/FSpotImporter.vala   |    4 +++-
 .../org.gnome.Shotwell.Imports.gresource.xml       |    6 ++++++
 3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/import.am b/import.am
index 13b67c2..551de0a 100644
--- a/import.am
+++ b/import.am
@@ -1,5 +1,5 @@
 plugin_LTLIBRARIES += plugins/shotwell-data-imports/shotwell-data-imports.la
-dist_plugin_DATA += plugins/shotwell-data-imports/f-spot-24.png
+dist_noinst_DATA += plugins/shotwell-data-imports/f-spot-24.png
 
 plugins_shotwell_data_imports_shotwell_data_imports_la_SOURCES = \
        plugins/shotwell-data-imports/FSpotDatabaseBehavior.vala \
@@ -18,6 +18,12 @@ plugins_shotwell_data_imports_shotwell_data_imports_la_SOURCES = \
        plugins/shotwell-data-imports/VersionNumber.vala \
        plugins/shotwell-plugin-common.vapi
 
+nodist_plugins_shotwell_data_imports_shotwell_data_imports_la_SOURCES = \
+       plugins/shotwell-data-imports/resource.c
+
+plugins/shotwell-data-imports/resource.c: 
plugins/shotwell-data-imports/org.gnome.Shotwell.Imports.gresource.xml
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=plugins/shotwell-data-imports --generate 
$<
+
 plugins_shotwell_data_imports_shotwell_data_imports_la_VALAFLAGS = \
        $(COMMON_VALAFLAGS) \
        --pkg gtk+-3.0 \
@@ -33,6 +39,7 @@ plugins_shotwell_data_imports_shotwell_data_imports_la_VALAFLAGS = \
        --vapidir $(abs_top_srcdir)/plugins
 
 plugins_shotwell_data_imports_shotwell_data_imports_la_CFLAGS = \
+       -DPLUGIN_RESOURCE_PATH='"/org/gnome/Shotwell/Imports"' \
        $(PLUGIN_CFLAGS) \
        $(COMMON_CFLAGS) \
        -I $(abs_top_srcdir)/plugins
diff --git a/plugins/shotwell-data-imports/FSpotImporter.vala 
b/plugins/shotwell-data-imports/FSpotImporter.vala
index 145fd7b..be04cf9 100644
--- a/plugins/shotwell-data-imports/FSpotImporter.vala
+++ b/plugins/shotwell-data-imports/FSpotImporter.vala
@@ -13,7 +13,9 @@ public class FSpotService : Object, Spit.Pluggable, Spit.DataImports.Service {
         // initialize the database layer
         DataImports.FSpot.Db.init();
         if (icon_pixbuf_set == null)
-            icon_pixbuf_set = Resources.load_icon_set(resource_directory.get_child(ICON_FILENAME));
+            icon_pixbuf_set =
+                Resources.load_from_resource("/org/gnome/Shotwell/Imports/"
+                        + ICON_FILENAME);
     }
     
     public int get_pluggable_interface(int min_host_interface, int max_host_interface) {
diff --git a/plugins/shotwell-data-imports/org.gnome.Shotwell.Imports.gresource.xml 
b/plugins/shotwell-data-imports/org.gnome.Shotwell.Imports.gresource.xml
new file mode 100644
index 0000000..0c77317
--- /dev/null
+++ b/plugins/shotwell-data-imports/org.gnome.Shotwell.Imports.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/Shotwell/Imports">
+    <file>f-spot-24.png</file>
+  </gresource>
+</gresources>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]