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




commit 211d4419ed95f96fc396a02762271445d567a0e2
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

 meson.build               |  2 +-
 src/nautilus-thumbnails.c | 22 +++++++++++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5376f8084..ff723b343 100644
--- a/meson.build
+++ b/meson.build
@@ -107,7 +107,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-4', version: '>= 1.0.0')
+gnome_desktop = dependency('gnome-desktop-4', version: '>= 43')
 gtk = dependency('gtk4', version: '>= 4.6')
 libadwaita = dependency('libadwaita-1', version: '>= 1.0')
 libportal = []
diff --git a/src/nautilus-thumbnails.c b/src/nautilus-thumbnails.c
index 8b532f260..438307357 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,26 @@ 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]