[nautilus/wip/antoniof/new-list-view-without-expanders: 10/13] enums: Redefine icon size options




commit 179e9439c72dfbabfb585be05582cc2fc3a6a85f
Author: António Fernandes <antoniof gnome org>
Date:   Mon Apr 11 20:23:24 2022 +0100

    enums: Redefine icon size options
    
    The new grid view introduces a new 256px icon size option, optimized
    for thumbnails. This was made possible because, unlike the old canvas,
    we have more control over the padding and can keep it low.
    
    However, with it, we have 5 size options now, which a little too many;
    in particular, the 64px size doesn't differ significantly enough from
    the 48px nor the 96px option now (the old canvas view this difference
    was more marked because padding increased in proportion).
    
    Similarly, the 48px option in the new list view is not significantly
    different from 32px and 64px. In the past, 32px didn't show thumbnails
    because the frames didn't allow the thumbnails to use the whole 32px;
    this would mark a difference vs. 48px. With the removal of thumbnail
    frames, this distinction is also gone.
    
    The 128px option in grid view is also not significantly larger than
    96px and yet significantly smaller than 256px.
    
    Drop the superfluous sizes, replace 128px size with 144px size for a
    more proportional increase, and rename the enum symbols.

 src/nautilus-directory-async.c   |  2 +-
 src/nautilus-enums.h             | 24 ++++++++++--------------
 src/nautilus-file.c              |  4 ++--
 src/nautilus-grid-cell.c         |  2 +-
 src/nautilus-grid-view.c         | 20 +++++++-------------
 src/nautilus-icon-info.h         |  3 ---
 src/nautilus-list-view.c         | 20 +++++++-------------
 src/nautilus-properties-window.c |  6 +++---
 src/nautilus-view-item.c         |  2 +-
 9 files changed, 32 insertions(+), 51 deletions(-)
---
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index 5fa29ae91..4899ea7b6 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -3704,7 +3704,7 @@ thumbnail_loader_size_prepared (GdkPixbufLoader *loader,
     aspect_ratio = ((double) width) / height;
 
     /* cf. nautilus_file_get_icon() */
-    max_thumbnail_size = NAUTILUS_GRID_ICON_SIZE_LARGEST * NAUTILUS_GRID_ICON_SIZE_STANDARD / 
NAUTILUS_GRID_ICON_SIZE_SMALL;
+    max_thumbnail_size = NAUTILUS_GRID_ICON_SIZE_EXTRA_LARGE * NAUTILUS_GRID_ICON_SIZE_MEDIUM / 
NAUTILUS_GRID_ICON_SIZE_SMALL;
     if (MAX (width, height) > max_thumbnail_size)
     {
         if (width > height)
diff --git a/src/nautilus-enums.h b/src/nautilus-enums.h
index 4145ed386..793e19c95 100644
--- a/src/nautilus-enums.h
+++ b/src/nautilus-enums.h
@@ -30,36 +30,32 @@
 
 typedef enum
 {
-    NAUTILUS_GRID_ICON_SIZE_SMALL    = 48,
-    NAUTILUS_GRID_ICON_SIZE_STANDARD = 64,
-    NAUTILUS_GRID_ICON_SIZE_LARGE    = 96,
-    NAUTILUS_GRID_ICON_SIZE_LARGER   = 128,
-    NAUTILUS_GRID_ICON_SIZE_LARGEST  = 256,
+    NAUTILUS_GRID_ICON_SIZE_SMALL       = 48,
+    NAUTILUS_GRID_ICON_SIZE_MEDIUM      = 96,
+    NAUTILUS_GRID_ICON_SIZE_LARGE       = 144,
+    NAUTILUS_GRID_ICON_SIZE_EXTRA_LARGE = 256,
 } NautilusGridIconSize;
 
 typedef enum
 {
     NAUTILUS_GRID_ZOOM_LEVEL_SMALL,
-    NAUTILUS_GRID_ZOOM_LEVEL_STANDARD,
+    NAUTILUS_GRID_ZOOM_LEVEL_MEDIUM,
     NAUTILUS_GRID_ZOOM_LEVEL_LARGE,
-    NAUTILUS_GRID_ZOOM_LEVEL_LARGER,
-    NAUTILUS_GRID_ZOOM_LEVEL_LARGEST,
+    NAUTILUS_GRID_ZOOM_LEVEL_EXTRA_LARGE,
 } NautilusGridZoomLevel;
 
 typedef enum
 {
-    NAUTILUS_LIST_ICON_SIZE_SMALL    = 16,
-    NAUTILUS_LIST_ICON_SIZE_STANDARD = 32,
-    NAUTILUS_LIST_ICON_SIZE_LARGE    = 48,
-    NAUTILUS_LIST_ICON_SIZE_LARGER   = 64,
+    NAUTILUS_LIST_ICON_SIZE_SMALL  = 16,
+    NAUTILUS_LIST_ICON_SIZE_MEDIUM = 32,
+    NAUTILUS_LIST_ICON_SIZE_LARGE  = 64,
 } NautilusListIconSize;
 
 typedef enum
 {
     NAUTILUS_LIST_ZOOM_LEVEL_SMALL,
-    NAUTILUS_LIST_ZOOM_LEVEL_STANDARD,
+    NAUTILUS_LIST_ZOOM_LEVEL_MEDIUM,
     NAUTILUS_LIST_ZOOM_LEVEL_LARGE,
-    NAUTILUS_LIST_ZOOM_LEVEL_LARGER,
 } NautilusListZoomLevel;
 
 typedef enum
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 4d3d4a74b..5bdc0e125 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5216,7 +5216,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
     }
     else
     {
-        modified_size = size * scale * NAUTILUS_GRID_ICON_SIZE_STANDARD / NAUTILUS_GRID_ICON_SIZE_SMALL;
+        modified_size = size * scale * NAUTILUS_GRID_ICON_SIZE_MEDIUM / NAUTILUS_GRID_ICON_SIZE_SMALL;
     }
 
     if (file->details->thumbnail)
@@ -5226,7 +5226,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
 
         s = MAX (w, h);
         /* Don't scale up small thumbnails in the standard view */
-        if (s <= NAUTILUS_GRID_ICON_SIZE_STANDARD)
+        if (s <= NAUTILUS_GRID_ICON_SIZE_MEDIUM)
         {
             thumb_scale = (double) size / NAUTILUS_GRID_ICON_SIZE_SMALL;
         }
diff --git a/src/nautilus-grid-cell.c b/src/nautilus-grid-cell.c
index b692475a2..426a2c2a8 100644
--- a/src/nautilus-grid-cell.c
+++ b/src/nautilus-grid-cell.c
@@ -52,7 +52,7 @@ update_icon (NautilusGridCell *self)
     /* Set the same height and width for all icons regardless of aspect ratio.
      */
     gtk_widget_set_size_request (self->fixed_height_box, icon_size, icon_size);
-    if (icon_size < NAUTILUS_GRID_ICON_SIZE_LARGEST)
+    if (icon_size < NAUTILUS_GRID_ICON_SIZE_EXTRA_LARGE)
     {
         int extra_margins = 0.5 * EXTRA_WIDTH_FOR_TEXT;
         gtk_widget_set_margin_start (self->fixed_height_box, extra_margins);
diff --git a/src/nautilus-grid-view.c b/src/nautilus-grid-view.c
index a984d21cd..e6fbfe6ba 100644
--- a/src/nautilus-grid-view.c
+++ b/src/nautilus-grid-view.c
@@ -59,7 +59,7 @@ real_bump_zoom_level (NautilusFilesView *files_view,
     new_level = self->zoom_level + zoom_increment;
 
     if (new_level >= NAUTILUS_GRID_ZOOM_LEVEL_SMALL &&
-        new_level <= NAUTILUS_GRID_ZOOM_LEVEL_LARGEST)
+        new_level <= NAUTILUS_GRID_ZOOM_LEVEL_EXTRA_LARGE)
     {
         g_action_group_change_action_state (self->action_group,
                                             "zoom-to-level",
@@ -78,9 +78,9 @@ get_icon_size_for_zoom_level (NautilusGridZoomLevel zoom_level)
         }
         break;
 
-        case NAUTILUS_GRID_ZOOM_LEVEL_STANDARD:
+        case NAUTILUS_GRID_ZOOM_LEVEL_MEDIUM:
         {
-            return NAUTILUS_GRID_ICON_SIZE_STANDARD;
+            return NAUTILUS_GRID_ICON_SIZE_MEDIUM;
         }
         break;
 
@@ -90,19 +90,13 @@ get_icon_size_for_zoom_level (NautilusGridZoomLevel zoom_level)
         }
         break;
 
-        case NAUTILUS_GRID_ZOOM_LEVEL_LARGER:
+        case NAUTILUS_GRID_ZOOM_LEVEL_EXTRA_LARGE:
         {
-            return NAUTILUS_GRID_ICON_SIZE_LARGER;
-        }
-        break;
-
-        case NAUTILUS_GRID_ZOOM_LEVEL_LARGEST:
-        {
-            return NAUTILUS_GRID_ICON_SIZE_LARGEST;
+            return NAUTILUS_GRID_ICON_SIZE_EXTRA_LARGE;
         }
         break;
     }
-    g_return_val_if_reached (NAUTILUS_GRID_ICON_SIZE_STANDARD);
+    g_return_val_if_reached (NAUTILUS_GRID_ICON_SIZE_MEDIUM);
 }
 
 static gint
@@ -192,7 +186,7 @@ real_can_zoom_in (NautilusFilesView *files_view)
 {
     NautilusGridView *self = NAUTILUS_GRID_VIEW (files_view);
 
-    return self->zoom_level < NAUTILUS_GRID_ZOOM_LEVEL_LARGEST;
+    return self->zoom_level < NAUTILUS_GRID_ZOOM_LEVEL_EXTRA_LARGE;
 }
 
 static gboolean
diff --git a/src/nautilus-icon-info.h b/src/nautilus-icon-info.h
index e5fab7a6b..074789fda 100644
--- a/src/nautilus-icon-info.h
+++ b/src/nautilus-icon-info.h
@@ -8,9 +8,6 @@
 
 G_BEGIN_DECLS
 
-#define NAUTILUS_LIST_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_LIST_ZOOM_LEVEL_LARGER + 1)
-#define NAUTILUS_GRID_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_GRID_ZOOM_LEVEL_LARGEST + 1)
-
 /* Maximum size of an icon that the icon factory will ever produce */
 #define NAUTILUS_ICON_MAXIMUM_SIZE     320
 
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 49ad0f90d..342eed2b7 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -74,9 +74,9 @@ get_icon_size_for_zoom_level (NautilusListZoomLevel zoom_level)
         }
         break;
 
-        case NAUTILUS_LIST_ZOOM_LEVEL_STANDARD:
+        case NAUTILUS_LIST_ZOOM_LEVEL_MEDIUM:
         {
-            return NAUTILUS_LIST_ICON_SIZE_STANDARD;
+            return NAUTILUS_LIST_ICON_SIZE_MEDIUM;
         }
         break;
 
@@ -85,14 +85,8 @@ get_icon_size_for_zoom_level (NautilusListZoomLevel zoom_level)
             return NAUTILUS_LIST_ICON_SIZE_LARGE;
         }
         break;
-
-        case NAUTILUS_LIST_ZOOM_LEVEL_LARGER:
-        {
-            return NAUTILUS_LIST_ICON_SIZE_LARGER;
-        }
-        break;
     }
-    g_return_val_if_reached (NAUTILUS_LIST_ICON_SIZE_STANDARD);
+    g_return_val_if_reached (NAUTILUS_LIST_ICON_SIZE_MEDIUM);
 }
 
 static guint
@@ -757,7 +751,7 @@ real_bump_zoom_level (NautilusFilesView *files_view,
     new_level = self->zoom_level + zoom_increment;
 
     if (new_level >= NAUTILUS_LIST_ZOOM_LEVEL_SMALL &&
-        new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGER)
+        new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGE)
     {
         g_action_group_change_action_state (self->action_group,
                                             "zoom-to-level",
@@ -784,7 +778,7 @@ real_restore_standard_zoom_level (NautilusFilesView *files_view)
     self = NAUTILUS_LIST_VIEW (files_view);
     g_action_group_change_action_state (self->action_group,
                                         "zoom-to-level",
-                                        g_variant_new_int32 (NAUTILUS_LIST_ZOOM_LEVEL_STANDARD));
+                                        g_variant_new_int32 (NAUTILUS_LIST_ZOOM_LEVEL_MEDIUM));
 }
 
 static gboolean
@@ -792,7 +786,7 @@ real_can_zoom_in (NautilusFilesView *files_view)
 {
     NautilusListView *self = NAUTILUS_LIST_VIEW (files_view);
 
-    return self->zoom_level < NAUTILUS_LIST_ZOOM_LEVEL_LARGER;
+    return self->zoom_level < NAUTILUS_LIST_ZOOM_LEVEL_LARGE;
 }
 
 static gboolean
@@ -812,7 +806,7 @@ real_is_zoom_level_default (NautilusFilesView *files_view)
     self = NAUTILUS_LIST_VIEW (files_view);
     icon_size = get_icon_size_for_zoom_level (self->zoom_level);
 
-    return icon_size == NAUTILUS_LIST_ICON_SIZE_STANDARD;
+    return icon_size == NAUTILUS_LIST_ICON_SIZE_MEDIUM;
 }
 
 static void
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 6050683f2..b3bfa1991 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -414,13 +414,13 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
 
         if (!icon)
         {
-            icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_STANDARD, icon_scale,
+            icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_MEDIUM, icon_scale,
                                            NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
                                            NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
         }
         else
         {
-            new_icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_STANDARD, icon_scale,
+            new_icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_MEDIUM, icon_scale,
                                                NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
                                                NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
             if (!new_icon || new_icon != icon)
@@ -436,7 +436,7 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
     {
         g_autoptr (GIcon) gicon = g_themed_icon_new ("text-x-generic");
 
-        icon = nautilus_icon_info_lookup (gicon, NAUTILUS_GRID_ICON_SIZE_STANDARD, icon_scale);
+        icon = nautilus_icon_info_lookup (gicon, NAUTILUS_GRID_ICON_SIZE_MEDIUM, icon_scale);
     }
 
     if (icon_name != NULL)
diff --git a/src/nautilus-view-item.c b/src/nautilus-view-item.c
index 141046963..560cfec42 100644
--- a/src/nautilus-view-item.c
+++ b/src/nautilus-view-item.c
@@ -157,7 +157,7 @@ nautilus_view_item_class_init (NautilusViewItemClass *klass)
     properties[PROP_ICON_SIZE] = g_param_spec_int ("icon-size",
                                                    "", "",
                                                    NAUTILUS_LIST_ICON_SIZE_SMALL,
-                                                   NAUTILUS_GRID_ICON_SIZE_LARGEST,
+                                                   NAUTILUS_GRID_ICON_SIZE_EXTRA_LARGE,
                                                    NAUTILUS_GRID_ICON_SIZE_LARGE,
                                                    G_PARAM_READWRITE | G_PARAM_CONSTRUCT | 
G_PARAM_STATIC_STRINGS);
     properties[PROP_IS_CUT] = g_param_spec_boolean ("is-cut",


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