[gnome-books/wip/hadess/app-provided-pixbuf-loader: 4/5] main: Load application provided pixbuf loaders



commit 4d49e9b300aec1ff5443c3793bba591a3879c13d
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Feb 28 15:10:44 2019 +0100

    main: Load application provided pixbuf loaders
    
    See https://gitlab.gnome.org/GNOME/gdk-pixbuf/merge_requests/34

 meson.build        | 3 +++
 src/application.js | 8 ++++++++
 src/config.js.in   | 3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index fb7e5204..f6a6b8aa 100644
--- a/meson.build
+++ b/meson.build
@@ -52,6 +52,9 @@ add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
 evince_req_version = '>= 3.13.3'
 tracker_req_version = '>= 0.17.3'
 
+gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.39.1')
+config_h.set_quoted('EXTRA_GDK_PIXBUF_LOADERS_DIR',
+                    join_paths (books_pkglibdir, 'gdk-pixbuf', 
gdk_pixbuf_dep.get_pkgconfig_variable('gdk_pixbuf_binary_version')))
 gjs_dep = dependency('gjs-1.0', version: '>= 1.48.0')
 gjs_console = gjs_dep.get_pkgconfig_variable('gjs_console')
 
diff --git a/src/application.js b/src/application.js
index 79b824c1..4fede2b0 100644
--- a/src/application.js
+++ b/src/application.js
@@ -29,6 +29,7 @@ const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
+const GdkPixbuf = imports.gi.GdkPixbuf;
 const Tracker = imports.gi.Tracker;
 const TrackerControl = imports.gi.TrackerControl;
 
@@ -107,6 +108,13 @@ var Application = new Lang.Class({
         // needed by data/ui/view-menu.ui
         GObject.type_ensure(Gio.ThemedIcon);
 
+        // init our pixbuf loaders
+        try {
+          GdkPixbuf.init_modules (EXTRA_GDK_PIXBUF_LOADERS_DIR);
+        } catch (e) {
+            // ignore error
+        }
+
         this.parent({ application_id: appid,
                       inactivity_timeout: 12000 });
 
diff --git a/src/config.js.in b/src/config.js.in
index 519365bd..ba006eda 100644
--- a/src/config.js.in
+++ b/src/config.js.in
@@ -1,3 +1,4 @@
 const PACKAGE_NAME = '@PACKAGE_NAME@';
 const PACKAGE_VERSION = '@PACKAGE_VERSION@';
-const GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@';
\ No newline at end of file
+const GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@';
+const EXTRA_GDK_PIXBUF_LOADERS_DIR = '@EXTRA_GDK_PIXBUF_LOADERS_DIR@';


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