[nautilus/wip/antoniof/gtk4-preparation-drop-libgd: 94/100] thumbnails: Add constant for minimum size to use




commit f4ad78ddae9dfe1452bb3ee3e7bab60e75585a7c
Author: António Fernandes <antoniof gnome org>
Date:   Mon Nov 1 22:26:52 2021 +0000

    thumbnails: Add constant for minimum size to use
    
    Currently, list view doesn't use thumbnails for its first zoom levels:
    SMALL (16px) and STANDARD (32px). So, it does display thumbnails for
    LARGE (48px) and LARGER (64px). On the other hand, the icon view uses
    displays for all zoom levels, the smallest being 48px.
    
    In short: thumbnails are displayed for zoom levels that request an
    icon size of 48 logical pixels. So, the minumum size of thumbs is 48px.
    
    This is implemented by checking that the current icon size is equal to
    or lower than NAUTILUS_LIST_ICON_SIZE_STANDARD (32px).
    
    However, we are going to need to check this condition in other places,
    so it would be best to have a constant specifically for this purpose.
    
    For the sake of naming this constant reasonably, let's use the minumum
    size of 48px and update the condition checking accordingly.

 src/nautilus-file.c       | 2 +-
 src/nautilus-thumbnails.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index d0a9a8d03..3f5d1399c 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5340,7 +5340,7 @@ nautilus_thumbnail_is_limited_by_zoom (int size,
 
     zoom_level = size * scale;
 
-    if (zoom_level <= NAUTILUS_LIST_ICON_SIZE_STANDARD)
+    if (zoom_level < NAUTILUS_THUMBNAIL_MINIMUM_ICON_SIZE)
     {
         return TRUE;
     }
diff --git a/src/nautilus-thumbnails.h b/src/nautilus-thumbnails.h
index 6babe6848..3557c9a5f 100644
--- a/src/nautilus-thumbnails.h
+++ b/src/nautilus-thumbnails.h
@@ -24,6 +24,8 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include "nautilus-file.h"
 
+#define NAUTILUS_THUMBNAIL_MINIMUM_ICON_SIZE 48
+
 /* Returns NULL if there's no thumbnail yet. */
 void       nautilus_create_thumbnail                (NautilusFile *file);
 gboolean   nautilus_can_thumbnail                   (NautilusFile *file);
@@ -32,4 +34,4 @@ gboolean   nautilus_thumbnail_is_mimetype_limited_by_size
 
 /* Queue handling: */
 void       nautilus_thumbnail_remove_from_queue     (const char   *file_uri);
-void       nautilus_thumbnail_prioritize            (const char   *file_uri);
\ No newline at end of file
+void       nautilus_thumbnail_prioritize            (const char   *file_uri);


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