[gnome-photos] Split the GEGL-related resources into a separate GResource



commit f1a3fa5ed329328189ab764c6b46fbc38fa0b730
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 28 00:41:36 2017 +0100

    Split the GEGL-related resources into a separate GResource
    
    The thumbnailer needs them, but not all the other resources that the
    application has.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690255

 src/Makefile.am                            |   17 +++++++++++++++++
 src/photos-application.c                   |   11 +++++++++++
 src/photos-gegl.gresource.xml              |    6 ++++++
 src/photos-operation-insta-hefe-vignette.c |    2 +-
 src/photos.gresource.xml                   |    1 -
 5 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index bddc91d..20eb1d4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,8 @@ gnome_photos_built_sources = \
        photos-mpris-player.h \
        photos-resources.c \
        photos-resources.h \
+       photos-resources-gegl.c \
+       photos-resources-gegl.h \
        photos-shell-search-provider2.c \
        photos-shell-search-provider2.h \
        photos-thumbnailer-dbus.c \
@@ -340,6 +342,7 @@ EXTRA_DIST = \
        photos-enums.h.template \
        photos-generate-about \
        photos.gresource.xml \
+       photos-gegl.gresource.xml \
        photos-dlna-renderers-dialog.ui \
        photos-export-dialog.ui \
        photos-help-overlay.ui \
@@ -533,6 +536,20 @@ photos-resources.h: photos.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sou
                --generate-header \
                $<
 
+photos-resources-gegl.c: photos-gegl.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) 
--generate-dependencies $(srcdir)/photos-gegl.gresource.xml)
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ \
+               --c-name photos_gegl \
+               --sourcedir=$(srcdir) \
+               --generate-source \
+               $<
+
+photos-resources-gegl.h: photos-gegl.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) 
--generate-dependencies $(srcdir)/photos-gegl.gresource.xml)
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ \
+               --c-name photos_gegl \
+               --sourcedir=$(srcdir) \
+               --generate-header \
+               $<
+
 photos-dleyna-renderer-device.h photos-dleyna-renderer-device.c: photos-dleyna-renderer-device.xml
        $(AM_V_GEN)gdbus-codegen \
                --c-namespace Dleyna \
diff --git a/src/photos-application.c b/src/photos-application.c
index 41ce776..5d74c3a 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -52,6 +52,7 @@
 #include "photos-properties-dialog.h"
 #include "photos-query.h"
 #include "photos-resources.h"
+#include "photos-resources-gegl.h"
 #include "photos-search-context.h"
 #include "photos-search-controller.h"
 #include "photos-search-match.h"
@@ -77,6 +78,7 @@ struct _PhotosApplication
   GList *miners;
   GList *miners_running;
   GResource *resource;
+  GResource *resource_gegl;
   GSettings *bg_settings;
   GSettings *ss_settings;
   GSimpleAction *blacks_exposure_action;
@@ -1691,6 +1693,9 @@ photos_application_startup (GApplication *application)
   self->resource = photos_get_resource ();
   g_resources_register (self->resource);
 
+  self->resource_gegl = photos_gegl_get_resource ();
+  g_resources_register (self->resource_gegl);
+
   icon_theme = gtk_icon_theme_get_default ();
   gtk_icon_theme_add_resource_path (icon_theme, "/org/gnome/Photos/icons");
 
@@ -1918,6 +1923,12 @@ photos_application_dispose (GObject *object)
       self->resource = NULL;
     }
 
+  if (self->resource_gegl != NULL)
+    {
+      g_resources_unregister (self->resource_gegl);
+      self->resource_gegl = NULL;
+    }
+
   g_clear_object (&self->create_window_cancellable);
   g_clear_object (&self->bg_settings);
   g_clear_object (&self->ss_settings);
diff --git a/src/photos-gegl.gresource.xml b/src/photos-gegl.gresource.xml
new file mode 100644
index 0000000..42eba6a
--- /dev/null
+++ b/src/photos-gegl.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/Photos/gegl">
+    <file alias="vignette.png" preprocess="to-pixdata">../data/vignette.png</file>
+  </gresource>
+</gresources>
diff --git a/src/photos-operation-insta-hefe-vignette.c b/src/photos-operation-insta-hefe-vignette.c
index 2a80ed7..b765ca1 100644
--- a/src/photos-operation-insta-hefe-vignette.c
+++ b/src/photos-operation-insta-hefe-vignette.c
@@ -215,7 +215,7 @@ photos_operation_insta_hefe_vignette_init (PhotosOperationInstaHefeVignette *sel
       GError *error;
 
       error = NULL;
-      vignette = gdk_pixbuf_new_from_resource ("/org/gnome/Photos/vignette.png", &error);
+      vignette = gdk_pixbuf_new_from_resource ("/org/gnome/Photos/gegl/vignette.png", &error);
       g_assert_no_error (error);
 
       vignette_channels = gdk_pixbuf_get_n_channels (vignette);
diff --git a/src/photos.gresource.xml b/src/photos.gresource.xml
index 6a60998..1142a74 100644
--- a/src/photos.gresource.xml
+++ b/src/photos.gresource.xml
@@ -13,7 +13,6 @@
     <file alias="sidebar-radio-prelight.svg" 
preprocess="to-pixdata">../data/sidebar-radio-prelight.svg</file>
     <file alias="sidebar-radio-selected.svg" 
preprocess="to-pixdata">../data/sidebar-radio-selected.svg</file>
     <file alias="sidebar-radio-selected-prelight.svg" 
preprocess="to-pixdata">../data/sidebar-radio-selected-prelight.svg</file>
-    <file alias="vignette.png" preprocess="to-pixdata">../data/vignette.png</file>
   </gresource>
 
   <gresource prefix="/org/gnome/Photos/gtk">


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