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




commit 4223a655f8fd2bc89e108e2e651b077abda7de42
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 different
    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.
    
    Drop the superfluous sizes and rename the enums to match the new menu
    item labels.

 src/nautilus-directory-async.c   |  2 +-
 src/nautilus-enums.h             | 24 ++++++++++--------------
 src/nautilus-file.c              |  4 ++--
 src/nautilus-grid-view-item-ui.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-model.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..2bf6250a6 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       = 128,
+    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-view-item-ui.c b/src/nautilus-grid-view-item-ui.c
index fe2f0f725..d77e5e7f1 100644
--- a/src/nautilus-grid-view-item-ui.c
+++ b/src/nautilus-grid-view-item-ui.c
@@ -54,7 +54,7 @@ update_icon (NautilusGridViewItemUi *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 e0099e18e..c1d9b64b8 100644
--- a/src/nautilus-grid-view.c
+++ b/src/nautilus-grid-view.c
@@ -57,7 +57,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",
@@ -76,9 +76,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;
 
@@ -88,19 +88,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 guint
@@ -206,7 +200,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 5f8daa2cc..177fe8f3f 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -72,9 +72,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;
 
@@ -83,14 +83,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
@@ -1378,7 +1372,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",
@@ -1423,7 +1417,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
@@ -1431,7 +1425,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
@@ -1451,7 +1445,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-model.c b/src/nautilus-view-item-model.c
index 13fecb98c..9620a9c36 100644
--- a/src/nautilus-view-item-model.c
+++ b/src/nautilus-view-item-model.c
@@ -153,7 +153,7 @@ nautilus_view_item_model_class_init (NautilusViewItemModelClass *klass)
                                                        "Icon size",
                                                        "The size in pixels of the icon",
                                                        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_object_class_install_property (object_class,


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