[gnome-directory-thumbnailer] core: Optionally drop gnome-desktop thumbnail API with new gdk-pixbuf



commit 095f4563fcc0718c62ee2b69fb481a232d149647
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Apr 30 10:18:45 2017 +0100

    core: Optionally drop gnome-desktop thumbnail API with new gdk-pixbuf
    
    If gdk-pixbuf >= 2.36.5 is available, its scaling API can do what we
    want, so we don’t need to use the deprecated gnome-desktop one.
    
    This doesn’t add any mandatory dependency bumps. It also doesn’t drop
    our gnome-desktop dependency, as we still use it for its thumbnail
    factory API.
    
    Signed-off-by: Philip Withnall <philip tecnocode co uk>

 configure.ac |    8 ++++++++
 src/main.c   |    7 ++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4cebab8..943704e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,14 @@ AC_SUBST([GDT_VERSION_MICRO])
 # gnome-directory-thumbnailer dependencies
 PKG_CHECK_MODULES(GDT, [gobject-2.0 glib-2.0 >= $GLIB_REQS gio-2.0 >= $GIO_REQS gdk-pixbuf-2.0 >= 
$GDK_PIXBUF_REQS gtk+-3.0 >= $GTK_REQS gnome-desktop-3.0 >= $GNOME_DESKTOP_REQS])
 
+# Optional higher gdk-pixbuf dependency
+PKG_CHECK_MODULES([GDK_PIXBUF], [gdk-pixbuf-2.0 >= 2.36.5],
+                  [have_gdk_pixbuf_2_36_5=yes], [have_gdk_pixbuf_2_36_5=no])
+AS_IF([test "$have_gdk_pixbuf_2_36_5" = "yes"], [
+       AC_DEFINE([HAVE_GDK_PIXBUF_2_36_5], [1],
+                 [Define if gdk-pixbuf >= 2.36.5 is available])
+])
+
 AC_CHECK_LIBM
 AC_SUBST([LIBM])
 
diff --git a/src/main.c b/src/main.c
index 133a7ea..f8d9a43 100644
--- a/src/main.c
+++ b/src/main.c
@@ -576,7 +576,12 @@ main (int argc, char *argv[])
                                goto done;
                        }
 
+#if HAVE_GDK_PIXBUF_2_36_5
+                       scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf, scaled_width, scaled_height, 
GDK_INTERP_HYPER);
+#else
                        scaled_pixbuf = gnome_desktop_thumbnail_scale_down_pixbuf (pixbuf, scaled_width, 
scaled_height);
+#endif
+
                        g_object_unref (pixbuf);
                        pixbuf = scaled_pixbuf;  /* transfer ownership */
                        scaled_pixbuf = NULL;
@@ -591,7 +596,7 @@ main (int argc, char *argv[])
                gint scaled_overlay_size, scaled_overlay_x, scaled_overlay_y;
                gdouble scale;
 
-               /* Re-query the dimensions since we don’t know which dimensions 
gnome_desktop_thumbnail_scale_down_pixbuf() chose. */
+               /* Re-query the dimensions since we don’t know which dimensions gdk_pixbuf_scale_simple() 
chose. */
                scaled_width = gdk_pixbuf_get_width (pixbuf);
                scaled_height = gdk_pixbuf_get_height (pixbuf);
 


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