summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2022-12-07 08:51:51 +0100
committerOndrej Holy <oholy@redhat.com>2023-01-04 09:57:31 +0100
commit755cfdce38312dfc6572839a6fdbb1b39e1b4fe6 (patch)
treeedb0479e936c7617ba982c9f999e49bf1c135d6b
parentd674de91ddb0816600d844ef6b181bc873476f84 (diff)
downloadnautilus-755cfdce38312dfc6572839a6fdbb1b39e1b4fe6.tar.gz
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
-rw-r--r--src/nautilus-file-private.h3
-rw-r--r--src/nautilus-file.c14
2 files changed, 16 insertions, 1 deletions
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 "nautilus-file-undo-operations.h"
#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
guint start_stop_type : 3; /* GDriveStartStopType */
guint can_poll_for_media : 1;
guint is_media_check_automatic : 1;
+ guint has_preview_icon : 1;
guint filesystem_readonly : 1;
guint 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);
}