From 4420025e7ff25b1a6d0da5e3a87fa5ea5dd94a91 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Mon, 11 Apr 2022 15:31:12 -0500 Subject: [PATCH] thumbnail: update for gnome-desktop thumbnail API changes See gnome-desktop!132 --- meson.build | 2 +- src/nautilus-thumbnails.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 5376f80846..ff723b3436 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 8b532f2608..1bad311e11 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. */ -- GitLab