[nautilus/wip/antoniof/flow-box-preparation: 25/28] general: Rename 'canvas' to 'grid' in enums




commit d64d7d2af89a6c373e664eaee054dbb86963b466
Author: António Fernandes <antoniof gnome org>
Date:   Sun Dec 12 18:43:04 2021 +0000

    general: Rename 'canvas' to 'grid' in enums
    
    These symbols are actually meant for both old and new "grid" views,
    in opposition to the "list" view, so this is a more appropriate name,
    considering both share NAUTILUS_VIEW_GRID_ID.

 data/org.gnome.nautilus.gschema.xml  |  4 +--
 src/nautilus-debug.c                 |  2 +-
 src/nautilus-debug.h                 |  2 +-
 src/nautilus-directory-async.c       |  2 +-
 src/nautilus-enums.h                 | 24 +++++++++---------
 src/nautilus-file.c                  |  6 ++---
 src/nautilus-icon-info.h             |  2 +-
 src/nautilus-operations-ui-manager.c |  4 +--
 src/nautilus-properties-window.c     |  8 +++---
 src/nautilus-view-icon-controller.c  | 48 ++++++++++++++++++------------------
 src/nautilus-view-item-model.c       |  6 ++---
 11 files changed, 54 insertions(+), 54 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 75f736e38..aa4306aea 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -36,7 +36,7 @@
     <value value="6" nick="starred"/>
   </enum>
 
-  <enum id="org.gnome.nautilus.CanvasZoomLevel">
+  <enum id="org.gnome.nautilus.GridZoomLevel">
     <value value="0" nick="small"/>
     <value value="1" nick="standard"/>
     <value value="2" nick="large"/>
@@ -219,7 +219,7 @@
       <summary>List of possible captions on icons</summary>
       <description>A list of captions below an icon in the icon view. The actual number of captions shown 
depends on the zoom level. Some possible values are: “size”, “type”, “date_modified”, “owner”, “group”, 
“permissions”, and “mime_type”.</description>
     </key>
-    <key name="default-zoom-level" enum="org.gnome.nautilus.CanvasZoomLevel">
+    <key name="default-zoom-level" enum="org.gnome.nautilus.GridZoomLevel">
       <default>'large'</default>
       <summary>Default icon view zoom level</summary>
     </key>
diff --git a/src/nautilus-debug.c b/src/nautilus-debug.c
index 59093f974..d189a6f9a 100644
--- a/src/nautilus-debug.c
+++ b/src/nautilus-debug.c
@@ -42,7 +42,7 @@ static GDebugKey keys[] =
     { "DirectoryView", NAUTILUS_DEBUG_DIRECTORY_VIEW },
     { "File", NAUTILUS_DEBUG_FILE },
     { "CanvasContainer", NAUTILUS_DEBUG_CANVAS_CONTAINER },
-    { "IconView", NAUTILUS_DEBUG_CANVAS_VIEW },
+    { "IconView", NAUTILUS_DEBUG_GRID_VIEW },
     { "ListView", NAUTILUS_DEBUG_LIST_VIEW },
     { "Mime", NAUTILUS_DEBUG_MIME },
     { "Places", NAUTILUS_DEBUG_PLACES },
diff --git a/src/nautilus-debug.h b/src/nautilus-debug.h
index 4d890e664..c277f37a5 100644
--- a/src/nautilus-debug.h
+++ b/src/nautilus-debug.h
@@ -36,7 +36,7 @@ typedef enum {
   NAUTILUS_DEBUG_DIRECTORY_VIEW = 1 << 5,
   NAUTILUS_DEBUG_FILE = 1 << 6,
   NAUTILUS_DEBUG_CANVAS_CONTAINER = 1 << 7,
-  NAUTILUS_DEBUG_CANVAS_VIEW = 1 << 8,
+  NAUTILUS_DEBUG_GRID_VIEW = 1 << 8,
   NAUTILUS_DEBUG_LIST_VIEW = 1 << 9,
   NAUTILUS_DEBUG_MIME = 1 << 10,
   NAUTILUS_DEBUG_PLACES = 1 << 11,
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index d5b93b5ac..901f5a38f 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -3684,7 +3684,7 @@ thumbnail_loader_size_prepared (GdkPixbufLoader *loader,
     aspect_ratio = ((double) width) / height;
 
     /* cf. nautilus_file_get_icon() */
-    max_thumbnail_size = NAUTILUS_CANVAS_ICON_SIZE_LARGEST * NAUTILUS_CANVAS_ICON_SIZE_STANDARD / 
NAUTILUS_CANVAS_ICON_SIZE_SMALL;
+    max_thumbnail_size = NAUTILUS_GRID_ICON_SIZE_LARGEST * NAUTILUS_GRID_ICON_SIZE_STANDARD / 
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 edfd99919..a597b7590 100644
--- a/src/nautilus-enums.h
+++ b/src/nautilus-enums.h
@@ -30,21 +30,21 @@
 
 typedef enum
 {
-    NAUTILUS_CANVAS_ICON_SIZE_SMALL    = 48,
-    NAUTILUS_CANVAS_ICON_SIZE_STANDARD = 64,
-    NAUTILUS_CANVAS_ICON_SIZE_LARGE    = 96,
-    NAUTILUS_CANVAS_ICON_SIZE_LARGER   = 128,
-    NAUTILUS_CANVAS_ICON_SIZE_LARGEST  = 256,
-} NautilusCanvasIconSize;
+    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,
+} NautilusGridIconSize;
 
 typedef enum
 {
-    NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL,
-    NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD,
-    NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE,
-    NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER,
-    NAUTILUS_CANVAS_ZOOM_LEVEL_LARGEST,
-} NautilusCanvasZoomLevel;
+    NAUTILUS_GRID_ZOOM_LEVEL_SMALL,
+    NAUTILUS_GRID_ZOOM_LEVEL_STANDARD,
+    NAUTILUS_GRID_ZOOM_LEVEL_LARGE,
+    NAUTILUS_GRID_ZOOM_LEVEL_LARGER,
+    NAUTILUS_GRID_ZOOM_LEVEL_LARGEST,
+} NautilusGridZoomLevel;
 
 typedef enum
 {
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 0d845593b..414656de0 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5208,7 +5208,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
     }
     else
     {
-        modified_size = size * scale * NAUTILUS_CANVAS_ICON_SIZE_STANDARD / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
+        modified_size = size * scale * NAUTILUS_GRID_ICON_SIZE_STANDARD / NAUTILUS_GRID_ICON_SIZE_SMALL;
     }
 
     if (file->details->thumbnail)
@@ -5218,9 +5218,9 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
 
         s = MAX (w, h);
         /* Don't scale up small thumbnails in the standard view */
-        if (s <= NAUTILUS_CANVAS_ICON_SIZE_STANDARD)
+        if (s <= NAUTILUS_GRID_ICON_SIZE_STANDARD)
         {
-            thumb_scale = (double) size / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
+            thumb_scale = (double) size / NAUTILUS_GRID_ICON_SIZE_SMALL;
         }
         else
         {
diff --git a/src/nautilus-icon-info.h b/src/nautilus-icon-info.h
index 64f643651..ed321dbfa 100644
--- a/src/nautilus-icon-info.h
+++ b/src/nautilus-icon-info.h
@@ -9,7 +9,7 @@
 G_BEGIN_DECLS
 
 #define NAUTILUS_LIST_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_LIST_ZOOM_LEVEL_LARGER + 1)
-#define NAUTILUS_CANVAS_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_CANVAS_ZOOM_LEVEL_LARGEST + 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-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c
index be6badcbe..4641a49f1 100644
--- a/src/nautilus-operations-ui-manager.c
+++ b/src/nautilus-operations-ui-manager.c
@@ -227,13 +227,13 @@ set_images (FileConflictDialogData *data)
     GdkPixbuf *destination_pixbuf;
 
     destination_pixbuf = nautilus_file_get_icon_pixbuf (data->destination,
-                                                        NAUTILUS_CANVAS_ICON_SIZE_SMALL,
+                                                        NAUTILUS_GRID_ICON_SIZE_SMALL,
                                                         TRUE,
                                                         1,
                                                         NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
 
     source_pixbuf = nautilus_file_get_icon_pixbuf (data->source,
-                                                   NAUTILUS_CANVAS_ICON_SIZE_SMALL,
+                                                   NAUTILUS_GRID_ICON_SIZE_SMALL,
                                                    TRUE,
                                                    1,
                                                    NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 998c6da91..ccc972f0d 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -412,13 +412,13 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
 
         if (!icon)
         {
-            icon = nautilus_file_get_icon (file, NAUTILUS_CANVAS_ICON_SIZE_STANDARD, icon_scale,
+            icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_STANDARD, icon_scale,
                                            NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
                                            NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
         }
         else
         {
-            new_icon = nautilus_file_get_icon (file, NAUTILUS_CANVAS_ICON_SIZE_STANDARD, icon_scale,
+            new_icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_STANDARD, icon_scale,
                                                NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
                                                NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
             if (!new_icon || new_icon != icon)
@@ -433,7 +433,7 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
     if (!icon)
     {
         icon = nautilus_icon_info_lookup_from_name ("text-x-generic",
-                                                    NAUTILUS_CANVAS_ICON_SIZE_STANDARD,
+                                                    NAUTILUS_GRID_ICON_SIZE_STANDARD,
                                                     icon_scale);
     }
 
@@ -444,7 +444,7 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
 
     if (icon_pixbuf != NULL)
     {
-        *icon_pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon, NAUTILUS_CANVAS_ICON_SIZE_STANDARD);
+        *icon_pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon, NAUTILUS_GRID_ICON_SIZE_STANDARD);
     }
 }
 
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index 59e8bfa83..a0dccfbea 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -117,7 +117,7 @@ static const SortConstants sorts_constants[] =
     }
 };
 
-static guint get_icon_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level);
+static guint get_icon_size_for_zoom_level (NautilusGridZoomLevel zoom_level);
 
 static const SortConstants *
 get_sorts_constants_from_action_target_name (const gchar *action_target_name)
@@ -499,12 +499,12 @@ real_bump_zoom_level (NautilusFilesView *files_view,
                       int                zoom_increment)
 {
     NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
-    NautilusCanvasZoomLevel new_level;
+    NautilusGridZoomLevel new_level;
 
     new_level = self->zoom_level + zoom_increment;
 
-    if (new_level >= NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL &&
-        new_level <= NAUTILUS_CANVAS_ZOOM_LEVEL_LARGEST)
+    if (new_level >= NAUTILUS_GRID_ZOOM_LEVEL_SMALL &&
+        new_level <= NAUTILUS_GRID_ZOOM_LEVEL_LARGEST)
     {
         g_action_group_change_action_state (self->action_group,
                                             "zoom-to-level",
@@ -513,47 +513,47 @@ real_bump_zoom_level (NautilusFilesView *files_view,
 }
 
 static guint
-get_icon_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level)
+get_icon_size_for_zoom_level (NautilusGridZoomLevel zoom_level)
 {
     switch (zoom_level)
     {
-        case NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL:
+        case NAUTILUS_GRID_ZOOM_LEVEL_SMALL:
         {
-            return NAUTILUS_CANVAS_ICON_SIZE_SMALL;
+            return NAUTILUS_GRID_ICON_SIZE_SMALL;
         }
         break;
 
-        case NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD:
+        case NAUTILUS_GRID_ZOOM_LEVEL_STANDARD:
         {
-            return NAUTILUS_CANVAS_ICON_SIZE_STANDARD;
+            return NAUTILUS_GRID_ICON_SIZE_STANDARD;
         }
         break;
 
-        case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE:
+        case NAUTILUS_GRID_ZOOM_LEVEL_LARGE:
         {
-            return NAUTILUS_CANVAS_ICON_SIZE_LARGE;
+            return NAUTILUS_GRID_ICON_SIZE_LARGE;
         }
         break;
 
-        case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER:
+        case NAUTILUS_GRID_ZOOM_LEVEL_LARGER:
         {
-            return NAUTILUS_CANVAS_ICON_SIZE_LARGER;
+            return NAUTILUS_GRID_ICON_SIZE_LARGER;
         }
         break;
 
-        case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGEST:
+        case NAUTILUS_GRID_ZOOM_LEVEL_LARGEST:
         {
-            return NAUTILUS_CANVAS_ICON_SIZE_LARGEST;
+            return NAUTILUS_GRID_ICON_SIZE_LARGEST;
         }
         break;
     }
-    g_return_val_if_reached (NAUTILUS_CANVAS_ICON_SIZE_STANDARD);
+    g_return_val_if_reached (NAUTILUS_GRID_ICON_SIZE_STANDARD);
 }
 
 static gint
 get_default_zoom_level (void)
 {
-    NautilusCanvasZoomLevel default_zoom_level;
+    NautilusGridZoomLevel default_zoom_level;
 
     default_zoom_level = g_settings_get_enum (nautilus_icon_view_preferences,
                                               NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL);
@@ -572,11 +572,11 @@ set_captions_from_preferences (NautilusViewIconController *self)
 
     /* Set a celling on the number of captions depending on the zoom level. */
     n_captions_for_zoom_level = G_N_ELEMENTS (self->caption_attributes);
-    if (self->zoom_level < NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE)
+    if (self->zoom_level < NAUTILUS_GRID_ZOOM_LEVEL_LARGE)
     {
         n_captions_for_zoom_level = MIN (1, n_captions_for_zoom_level);
     }
-    else if (self->zoom_level == NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE)
+    else if (self->zoom_level == NAUTILUS_GRID_ZOOM_LEVEL_LARGE)
     {
         n_captions_for_zoom_level = MIN (2, n_captions_for_zoom_level);
     }
@@ -638,7 +638,7 @@ real_restore_standard_zoom_level (NautilusFilesView *files_view)
     self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
     g_action_group_change_action_state (self->action_group,
                                         "zoom-to-level",
-                                        g_variant_new_int32 (NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE));
+                                        g_variant_new_int32 (NAUTILUS_GRID_ZOOM_LEVEL_LARGE));
 }
 
 static gfloat
@@ -647,7 +647,7 @@ real_get_zoom_level_percentage (NautilusFilesView *files_view)
     NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
 
     return (gfloat) get_icon_size_for_zoom_level (self->zoom_level) /
-           NAUTILUS_CANVAS_ICON_SIZE_LARGE;
+           NAUTILUS_GRID_ICON_SIZE_LARGE;
 }
 
 static gboolean
@@ -659,7 +659,7 @@ real_is_zoom_level_default (NautilusFilesView *files_view)
     self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
     icon_size = get_icon_size_for_zoom_level (self->zoom_level);
 
-    return icon_size == NAUTILUS_CANVAS_ICON_SIZE_LARGE;
+    return icon_size == NAUTILUS_GRID_ICON_SIZE_LARGE;
 }
 
 static gboolean
@@ -667,7 +667,7 @@ real_can_zoom_in (NautilusFilesView *files_view)
 {
     NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
 
-    return self->zoom_level < NAUTILUS_CANVAS_ZOOM_LEVEL_LARGEST;
+    return self->zoom_level < NAUTILUS_GRID_ZOOM_LEVEL_LARGEST;
 }
 
 static gboolean
@@ -675,7 +675,7 @@ real_can_zoom_out (NautilusFilesView *files_view)
 {
     NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
 
-    return self->zoom_level > NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL;
+    return self->zoom_level > NAUTILUS_GRID_ZOOM_LEVEL_SMALL;
 }
 
 static GdkRectangle *
diff --git a/src/nautilus-view-item-model.c b/src/nautilus-view-item-model.c
index 98d3de4a7..40e3ce9f1 100644
--- a/src/nautilus-view-item-model.c
+++ b/src/nautilus-view-item-model.c
@@ -138,9 +138,9 @@ nautilus_view_item_model_class_init (NautilusViewItemModelClass *klass)
                                      g_param_spec_int ("icon-size",
                                                        "Icon size",
                                                        "The size in pixels of the icon",
-                                                       NAUTILUS_CANVAS_ICON_SIZE_SMALL,
-                                                       NAUTILUS_CANVAS_ICON_SIZE_LARGEST,
-                                                       NAUTILUS_CANVAS_ICON_SIZE_LARGE,
+                                                       NAUTILUS_GRID_ICON_SIZE_SMALL,
+                                                       NAUTILUS_GRID_ICON_SIZE_LARGEST,
+                                                       NAUTILUS_GRID_ICON_SIZE_LARGE,
                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
     g_object_class_install_property (object_class,
                                      PROP_FILE,


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