[nautilus/gnome-42] thumbnail: update for gnome-desktop thumbnail API changes



commit fbc9bd6ff4ef32951391d4cdf89c27f58632f492
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Mon Apr 11 15:31:12 2022 -0500

    thumbnail: update for gnome-desktop thumbnail API changes
    
    See gnome-desktop!132
    
    Backported by António Fernandes <antoniof gnome org>

 meson.build               |  2 +-
 src/nautilus-thumbnails.c | 23 ++++++++++++++++++-----
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index 6e19609cd..91b132987 100644
--- a/meson.build
+++ b/meson.build
@@ -118,7 +118,7 @@ gio_unix = dependency('gio-unix-2.0', version: glib_ver)
 glib = dependency('glib-2.0', version: glib_ver)
 gmodule = dependency('gmodule-no-export-2.0', version: glib_ver)
 gnome_autoar = dependency('gnome-autoar-0', version: '>= 0.4.0')
-gnome_desktop = dependency('gnome-desktop-3.0', version: '>= 3.0.0')
+gnome_desktop = dependency('gnome-desktop-3.0', version: '>= 20.0.0')
 gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas', version: '>= 42')
 gtk = dependency('gtk+-3.0', version: '>= 3.22.27')
 libhandy = dependency('libhandy-1', version: '>= 1.5.0')
diff --git a/src/nautilus-thumbnails.c b/src/nautilus-thumbnails.c
index 8b532f260..1bad311e1 100644
--- a/src/nautilus-thumbnails.c
+++ b/src/nautilus-thumbnails.c
@@ -447,6 +447,7 @@ thumbnail_thread_func (GTask        *task,
     time_t current_orig_mtime = 0;
     time_t current_time;
     GList *node;
+    GError *error = NULL;
 
     thumbnail_factory = get_thumbnail_factory ();
 
@@ -529,7 +530,9 @@ thumbnail_thread_func (GTask        *task,
 
         pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (thumbnail_factory,
                                                                      info->image_uri,
-                                                                     info->mime_type);
+                                                                     info->mime_type,
+                                                                     NULL,
+                                                                     &error);
 
         if (pixbuf)
         {
@@ -539,17 +542,27 @@ thumbnail_thread_func (GTask        *task,
             gnome_desktop_thumbnail_factory_save_thumbnail (thumbnail_factory,
                                                             pixbuf,
                                                             info->image_uri,
-                                                            current_orig_mtime);
+                                                            current_orig_mtime,
+                                                            NULL,
+                                                            &error);
+            if (error)
+            {
+                DEBUG ("(Thumbnail Thread) Saving thumbnail failed: %s (%s)\n",
+                       info->image_uri, error->message);
+                g_clear_error (&error);
+            }
             g_object_unref (pixbuf);
         }
         else
         {
-            DEBUG ("(Thumbnail Thread) Thumbnail failed: %s\n",
-                   info->image_uri);
+            DEBUG ("(Thumbnail Thread) Thumbnail failed: %s (%s)\n",
+                   info->image_uri, error->message);
+            g_clear_error (&error);
 
             gnome_desktop_thumbnail_factory_create_failed_thumbnail (thumbnail_factory,
                                                                      info->image_uri,
-                                                                     current_orig_mtime);
+                                                                     current_orig_mtime,
+                                                                     NULL, NULL);
         }
         /* We need to call nautilus_file_changed(), but I don't think that is
          *  thread safe. So add an idle handler and do it from the main loop. */


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