Skip to content

Commit 8454290

Browse files
committed
nemo-file.c: Allow files with backend-provided previews to be
thumbnailed, even if their filesystem forbids it. Nemo's thumbnailer now returns the provided preview icon if one exists. Actual thumbnail visibility is still controlled by the user like normal. This will not guarantee thumbnails, if the device doesn't have any, but the couple Android devices I tried did have them. ref: #3055 #3458 #3291 https://gitlab.gnome.org/GNOME/nautilus/-/issues/1921
1 parent bc252a0 commit 8454290

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

libnemo-private/nemo-file-private.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <eel/eel-string.h>
3434

3535
#define NEMO_FILE_DEFAULT_ATTRIBUTES \
36-
"standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,id::filesystem,trash::orig-path,trash::deletion-date,metadata::*"
36+
"standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,id::filesystem,trash::orig-path,trash::deletion-date,metadata::*,preview::icon"
3737

3838
/* These are in the typical sort order. Known things come first, then
3939
* things where we can't know, finally things where we don't yet know.
@@ -180,6 +180,7 @@ struct NemoFileDetails
180180
eel_boolean_bit got_custom_display_name : 1;
181181
eel_boolean_bit got_custom_activation_uri : 1;
182182

183+
eel_boolean_bit has_preview_icon : 1;
183184
eel_boolean_bit thumbnail_is_up_to_date : 1;
184185
eel_boolean_bit thumbnail_wants_original : 1;
185186
eel_boolean_bit thumbnail_tried_original : 1;

libnemo-private/nemo-file.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,11 @@ update_info_internal (NemoFile *file,
26752675
file->details->trash_orig_path = g_strdup (trash_orig_path);
26762676
}
26772677

2678+
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_PREVIEW_ICON))
2679+
{
2680+
file->details->has_preview_icon = TRUE;
2681+
}
2682+
26782683
changed |=
26792684
nemo_file_update_metadata_from_info (file, info);
26802685

@@ -4388,7 +4393,7 @@ nemo_file_should_show_thumbnail (NemoFile *file)
43884393
}
43894394

43904395
use_preview = nemo_file_get_filesystem_use_preview (file);
4391-
if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) {
4396+
if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER && !file->details->has_preview_icon) {
43924397
/* file system says to never thumbnail anything */
43934398
return FALSE;
43944399
}

0 commit comments

Comments
 (0)