[nautilus/wip/antoniof/flow-box-preparation: 35/48] view-icon-item-ui: Draw shadow only if thumbnail available




commit be1768eab79c1413af0524f100be59747fae1854
Author: António Fernandes <antoniof gnome org>
Date:   Thu Dec 9 11:05:21 2021 +0000

    view-icon-item-ui: Draw shadow only if thumbnail available
    
    We have been drawing shadow on files which can be thumbnailed.
    
    This results in two bugs:
    - we draw shadow around the placeholder icon while creating thumbnails;
    - we don't draw shadow around thumbnails if the thumbnailer is missing.
    
    The second case happens under flatpak because we currently don't have
    access to thumbnailer programs from outside the sandbox.
    
    Instead, we should just check that a thumbnail path is set, meaning
    the file has got a thumbnail, which is what we need to know in order to
    correctly decide whether to draw a shadow.

 src/nautilus-view-icon-item-ui.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-view-icon-item-ui.c
index 76f07a3da..6cf844940 100644
--- a/src/nautilus-view-icon-item-ui.c
+++ b/src/nautilus-view-icon-item-ui.c
@@ -31,6 +31,7 @@ update_icon (NautilusViewIconItemUi *self)
     GtkStyleContext *style_context;
     NautilusFile *file;
     guint icon_size;
+    g_autofree gchar *thumbnail_path = NULL;
 
     file = nautilus_view_item_model_get_file (self->model);
     icon_size = nautilus_view_item_model_get_icon_size (self->model);
@@ -45,7 +46,8 @@ update_icon (NautilusViewIconItemUi *self)
 
     gtk_widget_set_size_request (self->fixed_height_box, icon_size, icon_size);
     style_context = gtk_widget_get_style_context (self->icon);
-    if (nautilus_can_thumbnail (file) &&
+    thumbnail_path = nautilus_file_get_thumbnail_path (file);
+    if (thumbnail_path != NULL &&
         nautilus_file_should_show_thumbnail (file))
     {
         gtk_style_context_add_class (style_context, "thumbnail");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]