[nautilus/wip/antoniof/hidpi-and-icons-cleanup: 2/9] properties-window: Fix disproportionate icons




commit 5572821ea8b895724683166997b7ad6df7184fba
Author: António Fernandes <antoniof gnome org>
Date:   Sun Aug 7 15:03:45 2022 +0100

    properties-window: Fix disproportionate icons
    
    Thumbnails in Properties were sometimes larger than the requested size.
    
    This is because we didn't pass the FORCE_THUMBNAIL_SIZE flag.
    
    There were probably good reasons for this flag in the past, but there
    are none now. If we request a size, that should be the size we get.
    
    So, drop this flag entirely and default to forcing the size everywhere.

 src/nautilus-dnd.c       |  2 +-
 src/nautilus-file.c      | 12 ++----------
 src/nautilus-file.h      |  4 +---
 src/nautilus-grid-cell.c |  3 +--
 src/nautilus-name-cell.c |  3 +--
 5 files changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index b6a87a1ba..e0f4a7177 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -242,7 +242,7 @@ get_paintable_for_drag_selection (GList *selection,
 
     /* The selection list is reversed compared to what the user sees. Get the
      * first items by starting from the end of the list. */
-    flags = (NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS | NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE);
+    flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS;
     for (GList *l = g_list_last (selection);
          l != NULL && g_queue_get_length (icons) <= MAX_DRAWN_DRAG_ICONS;
          l = l->prev)
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 709d4bf5d..b60d65d9b 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5157,14 +5157,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
     gicon = NULL;
     pixbuf = NULL;
 
-    if (flags & NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE)
-    {
-        modified_size = size * scale;
-    }
-    else
-    {
-        modified_size = size * scale * NAUTILUS_GRID_ICON_SIZE_MEDIUM / NAUTILUS_GRID_ICON_SIZE_SMALL;
-    }
+    modified_size = size * scale;
 
     if (file->details->thumbnail)
     {
@@ -5293,8 +5286,7 @@ nautilus_file_get_icon (NautilusFile          *file,
         goto out;
     }
 
-    DEBUG ("Called file_get_icon(), at size %d, force thumbnail %d", size,
-           flags & NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE);
+    DEBUG ("Called file_get_icon(), at size %d", size);
 
     if (flags & NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS &&
         nautilus_file_should_show_thumbnail (file) &&
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 1cd331777..68c7ff931 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -82,10 +82,8 @@ typedef enum {
        NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS = (1<<0),
        NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING = (1<<1),
        NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER = (1<<2),
-       /* whether the thumbnail size must match the display icon size */
-       NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE = (1<<3),
        /* uses the icon of the mount if present */
-       NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON = (1<<4),
+       NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON = (1<<3),
 } NautilusFileIconFlags;       
 
 #define NAUTILUS_THUMBNAIL_MINIMUM_ICON_SIZE 32
diff --git a/src/nautilus-grid-cell.c b/src/nautilus-grid-cell.c
index 4ed8455fb..63d9dc576 100644
--- a/src/nautilus-grid-cell.c
+++ b/src/nautilus-grid-cell.c
@@ -40,8 +40,7 @@ update_icon (NautilusGridCell *self)
     g_return_if_fail (item != NULL);
     file = nautilus_view_item_get_file (item);
     icon_size = nautilus_view_item_get_icon_size (item);
-    flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
-            NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE;
+    flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS;
 
     icon_paintable = nautilus_file_get_icon_paintable (file, icon_size, 1, flags);
     gtk_picture_set_paintable (GTK_PICTURE (self->icon), icon_paintable);
diff --git a/src/nautilus-name-cell.c b/src/nautilus-name-cell.c
index cf46e17e6..bab99561b 100644
--- a/src/nautilus-name-cell.c
+++ b/src/nautilus-name-cell.c
@@ -137,8 +137,7 @@ update_icon (NautilusNameCell *self)
 
     file = nautilus_view_item_get_file (item);
     icon_size = nautilus_view_item_get_icon_size (item);
-    flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
-            NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE;
+    flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS;
 
     icon_paintable = nautilus_file_get_icon_paintable (file, icon_size, 1, flags);
     gtk_picture_set_paintable (GTK_PICTURE (self->icon), icon_paintable);


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