From 395b5f7899bb65561a33130f50c9b6835abf43ca Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Thu, 6 Apr 2023 10:22:50 +0200 Subject: [PATCH] Generate thumbnails when the preview icon is available Resolves: rhbz#2120263 --- ...umbnails-when-the-preview-icon-is-av.patch | 76 +++++++++++++++++++ nautilus.spec | 8 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 file-Generate-thumbnails-when-the-preview-icon-is-av.patch diff --git a/file-Generate-thumbnails-when-the-preview-icon-is-av.patch b/file-Generate-thumbnails-when-the-preview-icon-is-av.patch new file mode 100644 index 0000000..9af2837 --- /dev/null +++ b/file-Generate-thumbnails-when-the-preview-icon-is-av.patch @@ -0,0 +1,76 @@ +From 755cfdce38312dfc6572839a6fdbb1b39e1b4fe6 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Wed, 7 Dec 2022 08:51:51 +0100 +Subject: [PATCH] file: Generate thumbnails when the preview icon is available + +Currently, thumbnails are not shown for MTP/GPhoto2 locations. The +backends return `G_FILESYSTEM_PREVIEW_TYPE_NEVER` in order to prevent +thumbnailers to make them unresponsive. However, the backends provide +preview icons for some file types and the `GnomeDesktopThumbnailFactory` +is smart enough not to invoke thumbnailers if the icon is available +(see https://bugzilla.gnome.org/show_bug.cgi?id=738503). Let's allow +the thumbnail generation from the preview icons if they are available. +This should not affect backend responsiveness much. + +Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1921 +--- + src/nautilus-file-private.h | 3 ++- + src/nautilus-file.c | 14 ++++++++++++++ + 2 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/src/nautilus-file-private.h b/src/nautilus-file-private.h +index d5d26c8b3..e9d49530c 100644 +--- a/src/nautilus-file-private.h ++++ b/src/nautilus-file-private.h +@@ -27,7 +27,7 @@ + #include + + #define NAUTILUS_FILE_DEFAULT_ATTRIBUTES \ +- "standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,id::filesystem,trash::orig-path,trash::deletion-date,metadata::*,recent::*" ++ "standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,id::filesystem,trash::orig-path,trash::deletion-date,metadata::*,recent::*,preview::icon" + + /* These are in the typical sort order. Known things come first, then + * things where we can't know, finally things where we don't yet know. +@@ -185,6 +185,7 @@ struct NautilusFileDetails + eel_boolean_bit start_stop_type : 3; /* GDriveStartStopType */ + eel_boolean_bit can_poll_for_media : 1; + eel_boolean_bit is_media_check_automatic : 1; ++ eel_boolean_bit has_preview_icon : 1; + + eel_boolean_bit filesystem_readonly : 1; + eel_boolean_bit filesystem_use_preview : 2; /* GFilesystemPreviewType */ +diff --git a/src/nautilus-file.c b/src/nautilus-file.c +index 2999f2fa5..d9d988ccd 100644 +--- a/src/nautilus-file.c ++++ b/src/nautilus-file.c +@@ -2914,6 +2914,11 @@ update_info_internal (NautilusFile *file, + file->details->trash_orig_path = g_strdup (trash_orig_path); + } + ++ if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_PREVIEW_ICON)) ++ { ++ file->details->has_preview_icon = TRUE; ++ } ++ + changed |= + nautilus_file_update_metadata_from_info (file, info); + +@@ -4836,6 +4841,15 @@ nautilus_file_should_show_thumbnail (NautilusFile *file) + return FALSE; + } + ++ if (show_file_thumbs != NAUTILUS_SPEED_TRADEOFF_NEVER && ++ file->details->has_preview_icon) ++ { ++ /* The thumbnail should be generated if the preview icon is available ++ * regardless of the filesystem type (i.e. for MTP/GPhoto2 backends). ++ */ ++ return TRUE; ++ } ++ + return get_speed_tradeoff_preference_for_file (file, show_file_thumbs); + } + +-- +2.39.2 + diff --git a/nautilus.spec b/nautilus.spec index 8829aff..225421f 100644 --- a/nautilus.spec +++ b/nautilus.spec @@ -6,7 +6,7 @@ Name: nautilus Version: 40.2 -Release: 12%{?dist} +Release: 13%{?dist} Summary: File manager for GNOME License: GPLv3+ @@ -42,6 +42,9 @@ Patch15: freedesktop-dbus-Try-to-own-the-name-until-after-exp.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2184292 Patch16: window-slot-Try-current-location-even-if-it-is-marke.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2120263 +Patch17: file-Generate-thumbnails-when-the-preview-icon-is-av.patch + BuildRequires: desktop-file-utils BuildRequires: gcc BuildRequires: gettext @@ -172,6 +175,9 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop %doc %{_datadir}/gtk-doc/html/libnautilus-extension/ %changelog +* Thu Apr 06 2023 Ondrej Holy - 40.2-13 +- Generate thumbnails when the preview icon is available (#2120263) + * Wed Apr 05 2023 Ondrej Holy - 40.2-12 - Try current location even if it is marked as gone (#2184292)