[nautilus/wip/antoniof/new-list-view-continuation: 2/10] view-icon-controller: Rename to NautilusGridView




commit 685af3e38ea2b7ca7dc4cc4e96dcebf284d38662
Author: António Fernandes <antoniof gnome org>
Date:   Sat Apr 9 00:21:20 2022 +0100

    view-icon-controller: Rename to NautilusGridView
    
    This is a clearer and shorter name.
    
    Also, after the previous extraction of NautilusFilesModelView,
    the "controller" part is mostly gone.

 po/POTFILES.in                                     |   2 +-
 src/meson.build                                    |   8 +-
 src/nautilus-files-view.c                          |   6 +-
 ...icon-item-ui.c => nautilus-grid-view-item-ui.c} |  60 +++++------
 src/nautilus-grid-view-item-ui.h                   |  30 ++++++
 ...view-icon-controller.c => nautilus-grid-view.c} | 118 ++++++++++-----------
 src/nautilus-grid-view.h                           |  17 +++
 src/nautilus-view-icon-controller.h                |  17 ---
 src/nautilus-view-icon-item-ui.h                   |  30 ------
 src/resources/nautilus.gresource.xml               |   2 +-
 ...on-item-ui.ui => nautilus-grid-view-item-ui.ui} |   2 +-
 11 files changed, 146 insertions(+), 146 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cea948da6..62769fa75 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -91,7 +91,7 @@ src/resources/ui/nautilus-starred-is-empty.ui
 src/resources/ui/nautilus-toolbar.ui
 src/resources/ui/nautilus-toolbar-view-menu.ui
 src/resources/ui/nautilus-trash-is-empty.ui
-src/resources/ui/nautilus-view-icon-item-ui.ui
+src/resources/ui/nautilus-grid-view-item-ui.ui
 src/resources/ui/nautilus-window.ui
 src/gtk/nautilusgtkplacesview.c
 src/gtk/nautilusgtkplacesviewrow.c
diff --git a/src/meson.build b/src/meson.build
index af1e9db83..b31fcd7a6 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -124,10 +124,10 @@ libnautilus_sources = [
   'nautilus-trash-bar.h',
   'nautilus-view.c',
   'nautilus-view.h',
-  'nautilus-view-icon-controller.c',
-  'nautilus-view-icon-controller.h',
-  'nautilus-view-icon-item-ui.c',
-  'nautilus-view-icon-item-ui.h',
+  'nautilus-grid-view.c',
+  'nautilus-grid-view.h',
+  'nautilus-grid-view-item-ui.c',
+  'nautilus-grid-view-item-ui.h',
   'nautilus-view-item-model.c',
   'nautilus-view-item-model.h',
   'nautilus-view-model.c',
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index ff827453e..644abec17 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -84,7 +84,7 @@
 #include "nautilus-trash-monitor.h"
 #include "nautilus-ui-utilities.h"
 #include "nautilus-view.h"
-#include "nautilus-view-icon-controller.h"
+#include "nautilus-grid-view.h"
 #include "nautilus-window.h"
 #include "nautilus-tracker-utilities.h"
 
@@ -3723,7 +3723,7 @@ done_loading (NautilusFilesView *view,
 
         if (do_reveal)
         {
-            if (NAUTILUS_IS_LIST_VIEW (view) || NAUTILUS_IS_VIEW_ICON_CONTROLLER (view))
+            if (NAUTILUS_IS_LIST_VIEW (view) || NAUTILUS_IS_GRID_VIEW (view))
             {
                 /* HACK: We should be able to directly call reveal_selection here,
                  * but at this point the GtkTreeView hasn't allocated the new nodes
@@ -9693,7 +9693,7 @@ nautilus_files_view_new (guint               id,
     {
         case NAUTILUS_VIEW_GRID_ID:
         {
-            view = NAUTILUS_FILES_VIEW (nautilus_view_icon_controller_new (slot));
+            view = NAUTILUS_FILES_VIEW (nautilus_grid_view_new (slot));
         }
         break;
 
diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-grid-view-item-ui.c
similarity index 84%
rename from src/nautilus-view-icon-item-ui.c
rename to src/nautilus-grid-view-item-ui.c
index d0ebff7b4..fe2f0f725 100644
--- a/src/nautilus-view-icon-item-ui.c
+++ b/src/nautilus-grid-view-item-ui.c
@@ -1,9 +1,9 @@
-#include "nautilus-view-icon-item-ui.h"
+#include "nautilus-grid-view-item-ui.h"
 #include "nautilus-view-item-model.h"
 #include "nautilus-file.h"
 #include "nautilus-thumbnails.h"
 
-struct _NautilusViewIconItemUi
+struct _NautilusGridViewItemUi
 {
     GtkBox parent_instance;
 
@@ -20,7 +20,7 @@ struct _NautilusViewIconItemUi
     gboolean called_once;
 };
 
-G_DEFINE_TYPE (NautilusViewIconItemUi, nautilus_view_icon_item_ui, GTK_TYPE_BOX)
+G_DEFINE_TYPE (NautilusGridViewItemUi, nautilus_grid_view_item_ui, GTK_TYPE_BOX)
 
 enum
 {
@@ -32,7 +32,7 @@ enum
 #define EXTRA_WIDTH_FOR_TEXT 36
 
 static void
-update_icon (NautilusViewIconItemUi *self)
+update_icon (NautilusGridViewItemUi *self)
 {
     NautilusFileIconFlags flags;
     g_autoptr (GdkPaintable) icon_paintable = NULL;
@@ -74,7 +74,7 @@ update_icon (NautilusViewIconItemUi *self)
 }
 
 static void
-update_captions (NautilusViewIconItemUi *self)
+update_captions (NautilusGridViewItemUi *self)
 {
     NautilusFile *file;
     GtkWidget * const caption_labels[] =
@@ -103,7 +103,7 @@ update_captions (NautilusViewIconItemUi *self)
 }
 
 static void
-on_file_changed (NautilusViewIconItemUi *self)
+on_file_changed (NautilusGridViewItemUi *self)
 {
     NautilusFile *file;
 
@@ -121,7 +121,7 @@ on_view_item_size_changed (GObject    *object,
                            GParamSpec *pspec,
                            gpointer    user_data)
 {
-    NautilusViewIconItemUi *self = NAUTILUS_VIEW_ICON_ITEM_UI (user_data);
+    NautilusGridViewItemUi *self = NAUTILUS_GRID_VIEW_ITEM_UI (user_data);
 
     update_icon (self);
     update_captions (self);
@@ -132,7 +132,7 @@ on_view_item_is_cut_changed (GObject    *object,
                              GParamSpec *pspec,
                              gpointer    user_data)
 {
-    NautilusViewIconItemUi *self = NAUTILUS_VIEW_ICON_ITEM_UI (user_data);
+    NautilusGridViewItemUi *self = NAUTILUS_GRID_VIEW_ITEM_UI (user_data);
     gboolean is_cut;
 
     g_object_get (object, "is-cut", &is_cut, NULL);
@@ -147,16 +147,16 @@ on_view_item_is_cut_changed (GObject    *object,
 }
 
 static void
-set_model (NautilusViewIconItemUi *self,
+set_model (NautilusGridViewItemUi *self,
            NautilusViewItemModel  *model);
 
 static void
 finalize (GObject *object)
 {
-    NautilusViewIconItemUi *self = (NautilusViewIconItemUi *) object;
+    NautilusGridViewItemUi *self = (NautilusGridViewItemUi *) object;
 
     set_model (self, NULL);
-    G_OBJECT_CLASS (nautilus_view_icon_item_ui_parent_class)->finalize (object);
+    G_OBJECT_CLASS (nautilus_grid_view_item_ui_parent_class)->finalize (object);
 }
 
 static void
@@ -165,7 +165,7 @@ get_property (GObject    *object,
               GValue     *value,
               GParamSpec *pspec)
 {
-    NautilusViewIconItemUi *self = NAUTILUS_VIEW_ICON_ITEM_UI (object);
+    NautilusGridViewItemUi *self = NAUTILUS_GRID_VIEW_ITEM_UI (object);
 
     switch (prop_id)
     {
@@ -181,7 +181,7 @@ get_property (GObject    *object,
 }
 
 static void
-set_model (NautilusViewIconItemUi *self,
+set_model (NautilusGridViewItemUi *self,
            NautilusViewItemModel  *model)
 {
     NautilusFile *file;
@@ -225,7 +225,7 @@ set_property (GObject      *object,
               const GValue *value,
               GParamSpec   *pspec)
 {
-    NautilusViewIconItemUi *self = NAUTILUS_VIEW_ICON_ITEM_UI (object);
+    NautilusGridViewItemUi *self = NAUTILUS_GRID_VIEW_ITEM_UI (object);
 
     switch (prop_id)
     {
@@ -241,7 +241,7 @@ set_property (GObject      *object,
 }
 
 static void
-nautilus_view_icon_item_ui_class_init (NautilusViewIconItemUiClass *klass)
+nautilus_grid_view_item_ui_class_init (NautilusGridViewItemUiClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
     GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
@@ -258,18 +258,18 @@ nautilus_view_icon_item_ui_class_init (NautilusViewIconItemUiClass *klass)
                                                           NAUTILUS_TYPE_VIEW_ITEM_MODEL,
                                                           G_PARAM_READWRITE));
 
-    gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/ui/nautilus-view-icon-item-ui.ui");
+    gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/ui/nautilus-grid-view-item-ui.ui");
 
-    gtk_widget_class_bind_template_child (widget_class, NautilusViewIconItemUi, fixed_height_box);
-    gtk_widget_class_bind_template_child (widget_class, NautilusViewIconItemUi, icon);
-    gtk_widget_class_bind_template_child (widget_class, NautilusViewIconItemUi, label);
-    gtk_widget_class_bind_template_child (widget_class, NautilusViewIconItemUi, first_caption);
-    gtk_widget_class_bind_template_child (widget_class, NautilusViewIconItemUi, second_caption);
-    gtk_widget_class_bind_template_child (widget_class, NautilusViewIconItemUi, third_caption);
+    gtk_widget_class_bind_template_child (widget_class, NautilusGridViewItemUi, fixed_height_box);
+    gtk_widget_class_bind_template_child (widget_class, NautilusGridViewItemUi, icon);
+    gtk_widget_class_bind_template_child (widget_class, NautilusGridViewItemUi, label);
+    gtk_widget_class_bind_template_child (widget_class, NautilusGridViewItemUi, first_caption);
+    gtk_widget_class_bind_template_child (widget_class, NautilusGridViewItemUi, second_caption);
+    gtk_widget_class_bind_template_child (widget_class, NautilusGridViewItemUi, third_caption);
 }
 
 static void
-nautilus_view_icon_item_ui_init (NautilusViewIconItemUi *self)
+nautilus_grid_view_item_ui_init (NautilusGridViewItemUi *self)
 {
     gtk_widget_init_template (GTK_WIDGET (self));
 
@@ -287,21 +287,21 @@ nautilus_view_icon_item_ui_init (NautilusViewIconItemUi *self)
 #endif
 }
 
-NautilusViewIconItemUi *
-nautilus_view_icon_item_ui_new (void)
+NautilusGridViewItemUi *
+nautilus_grid_view_item_ui_new (void)
 {
-    return g_object_new (NAUTILUS_TYPE_VIEW_ICON_ITEM_UI, NULL);
+    return g_object_new (NAUTILUS_TYPE_GRID_VIEW_ITEM_UI, NULL);
 }
 
 void
-nautilus_view_icon_item_ui_set_model (NautilusViewIconItemUi *self,
+nautilus_grid_view_item_ui_set_model (NautilusGridViewItemUi *self,
                                       NautilusViewItemModel  *model)
 {
     g_object_set (self, "model", model, NULL);
 }
 
 NautilusViewItemModel *
-nautilus_view_icon_item_ui_get_model (NautilusViewIconItemUi *self)
+nautilus_grid_view_item_ui_get_model (NautilusGridViewItemUi *self)
 {
     NautilusViewItemModel *model = NULL;
 
@@ -311,14 +311,14 @@ nautilus_view_icon_item_ui_get_model (NautilusViewIconItemUi *self)
 }
 
 void
-nautilus_view_item_ui_set_caption_attributes (NautilusViewIconItemUi *self,
+nautilus_view_item_ui_set_caption_attributes (NautilusGridViewItemUi *self,
                                               GQuark                 *attrs)
 {
     self->caption_attributes = attrs;
 }
 
 gboolean
-nautilus_view_icon_item_ui_once (NautilusViewIconItemUi *self)
+nautilus_grid_view_item_ui_once (NautilusGridViewItemUi *self)
 {
     if (self->called_once)
     {
diff --git a/src/nautilus-grid-view-item-ui.h b/src/nautilus-grid-view-item-ui.h
new file mode 100644
index 000000000..153831768
--- /dev/null
+++ b/src/nautilus-grid-view-item-ui.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "nautilus-view-item-model.h"
+
+G_BEGIN_DECLS
+
+enum
+{
+    NAUTILUS_VIEW_ICON_FIRST_CAPTION,
+    NAUTILUS_VIEW_ICON_SECOND_CAPTION,
+    NAUTILUS_VIEW_ICON_THIRD_CAPTION,
+    NAUTILUS_VIEW_ICON_N_CAPTIONS
+};
+
+#define NAUTILUS_TYPE_GRID_VIEW_ITEM_UI (nautilus_grid_view_item_ui_get_type())
+
+G_DECLARE_FINAL_TYPE (NautilusGridViewItemUi, nautilus_grid_view_item_ui, NAUTILUS, GRID_VIEW_ITEM_UI, 
GtkBox)
+
+NautilusGridViewItemUi * nautilus_grid_view_item_ui_new (void);
+void nautilus_grid_view_item_ui_set_model (NautilusGridViewItemUi *self,
+                                           NautilusViewItemModel  *model);
+NautilusViewItemModel *nautilus_grid_view_item_ui_get_model (NautilusGridViewItemUi *self);
+void nautilus_view_item_ui_set_caption_attributes (NautilusGridViewItemUi *self,
+                                                   GQuark                 *attrs);
+gboolean nautilus_grid_view_item_ui_once (NautilusGridViewItemUi *self);
+
+G_END_DECLS
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-grid-view.c
similarity index 85%
rename from src/nautilus-view-icon-controller.c
rename to src/nautilus-grid-view.c
index e02f1984c..dc741c526 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-grid-view.c
@@ -1,10 +1,10 @@
-#include "nautilus-view-icon-controller.h"
+#include "nautilus-grid-view.h"
 #include "nautilus-view-item-model.h"
-#include "nautilus-view-icon-item-ui.h"
+#include "nautilus-grid-view-item-ui.h"
 #include "nautilus-file.h"
 #include "nautilus-global-preferences.h"
 
-struct _NautilusViewIconController
+struct _NautilusGridView
 {
     NautilusFilesModelView parent_instance;
 
@@ -24,16 +24,16 @@ struct _NautilusViewIconController
     gboolean reversed;
 };
 
-G_DEFINE_TYPE (NautilusViewIconController, nautilus_view_icon_controller, NAUTILUS_TYPE_FILES_MODEL_VIEW)
+G_DEFINE_TYPE (NautilusGridView, nautilus_grid_view, NAUTILUS_TYPE_FILES_MODEL_VIEW)
 
 static guint get_icon_size_for_zoom_level (NautilusGridZoomLevel zoom_level);
 
 static gint
-nautilus_view_icon_controller_sort (gconstpointer a,
-                                    gconstpointer b,
-                                    gpointer      user_data)
+nautilus_grid_view_sort (gconstpointer a,
+                         gconstpointer b,
+                         gpointer      user_data)
 {
-    NautilusViewIconController *self = user_data;
+    NautilusGridView *self = user_data;
     NautilusFile *file_a;
     NautilusFile *file_b;
 
@@ -50,7 +50,7 @@ static void
 real_bump_zoom_level (NautilusFilesView *files_view,
                       int                zoom_increment)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (files_view);
     NautilusGridZoomLevel new_level;
 
     new_level = self->zoom_level + zoom_increment;
@@ -105,7 +105,7 @@ get_icon_size_for_zoom_level (NautilusGridZoomLevel zoom_level)
 static guint
 real_get_icon_size (NautilusFilesModelView *files_model_view)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_model_view);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (files_model_view);
 
     return get_icon_size_for_zoom_level (self->zoom_level);
 }
@@ -113,7 +113,7 @@ real_get_icon_size (NautilusFilesModelView *files_model_view)
 static GtkWidget *
 real_get_view_ui (NautilusFilesModelView *files_model_view)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_model_view);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (files_model_view);
 
     return GTK_WIDGET (self->view_ui);
 }
@@ -130,7 +130,7 @@ get_default_zoom_level (void)
 }
 
 static void
-set_captions_from_preferences (NautilusViewIconController *self)
+set_captions_from_preferences (NautilusGridView *self)
 {
     g_auto (GStrv) value = NULL;
     gint n_captions_for_zoom_level;
@@ -161,13 +161,13 @@ set_captions_from_preferences (NautilusViewIconController *self)
 }
 
 static void
-set_zoom_level (NautilusViewIconController *self,
-                guint                       new_level)
+set_zoom_level (NautilusGridView *self,
+                guint             new_level)
 {
     self->zoom_level = new_level;
 
     /* The zoom level may change how many captions are allowed. Update it before
-     * setting the icon size, under the assumption that NautilusViewIconItemUi
+     * setting the icon size, under the assumption that NautilusGridViewItemUi
      * updates captions whenever the icon size is set*/
     set_captions_from_preferences (self);
 
@@ -180,9 +180,9 @@ set_zoom_level (NautilusViewIconController *self,
 static void
 real_restore_standard_zoom_level (NautilusFilesView *files_view)
 {
-    NautilusViewIconController *self;
+    NautilusGridView *self;
 
-    self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    self = NAUTILUS_GRID_VIEW (files_view);
     g_action_group_change_action_state (self->action_group,
                                         "zoom-to-level",
                                         g_variant_new_int32 (NAUTILUS_GRID_ZOOM_LEVEL_LARGE));
@@ -191,10 +191,10 @@ real_restore_standard_zoom_level (NautilusFilesView *files_view)
 static gboolean
 real_is_zoom_level_default (NautilusFilesView *files_view)
 {
-    NautilusViewIconController *self;
+    NautilusGridView *self;
     guint icon_size;
 
-    self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    self = NAUTILUS_GRID_VIEW (files_view);
     icon_size = get_icon_size_for_zoom_level (self->zoom_level);
 
     return icon_size == NAUTILUS_GRID_ICON_SIZE_LARGE;
@@ -203,7 +203,7 @@ real_is_zoom_level_default (NautilusFilesView *files_view)
 static gboolean
 real_can_zoom_in (NautilusFilesView *files_view)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (files_view);
 
     return self->zoom_level < NAUTILUS_GRID_ZOOM_LEVEL_LARGEST;
 }
@@ -211,7 +211,7 @@ real_can_zoom_in (NautilusFilesView *files_view)
 static gboolean
 real_can_zoom_out (NautilusFilesView *files_view)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (files_view);
 
     return self->zoom_level > NAUTILUS_GRID_ZOOM_LEVEL_SMALL;
 }
@@ -220,7 +220,7 @@ static void
 real_scroll_to_item (NautilusFilesModelView *files_model_view,
                      guint                   position)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_model_view);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (files_model_view);
 
     gtk_widget_activate_action (GTK_WIDGET (self->view_ui),
                                 "list.scroll-to-item",
@@ -229,7 +229,7 @@ real_scroll_to_item (NautilusFilesModelView *files_model_view,
 }
 
 static void
-set_click_mode_from_settings (NautilusViewIconController *self)
+set_click_mode_from_settings (NautilusGridView *self)
 {
     int click_policy;
 
@@ -242,13 +242,13 @@ set_click_mode_from_settings (NautilusViewIconController *self)
 static void
 real_click_policy_changed (NautilusFilesView *files_view)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (files_view);
     set_click_mode_from_settings (self);
 }
 
 static void
-activate_selection_on_click (NautilusViewIconController *self,
-                             gboolean                    open_in_new_tab)
+activate_selection_on_click (NautilusGridView *self,
+                             gboolean          open_in_new_tab)
 {
     g_autolist (NautilusFile) selection = NULL;
     NautilusOpenFlags flags = 0;
@@ -270,7 +270,7 @@ on_click_pressed (GtkGestureClick *gesture,
                   gdouble          y,
                   gpointer         user_data)
 {
-    NautilusViewIconController *self;
+    NautilusGridView *self;
     GtkWidget *event_widget;
     guint button;
     GdkModifierType modifiers;
@@ -278,7 +278,7 @@ on_click_pressed (GtkGestureClick *gesture,
     gdouble view_x;
     gdouble view_y;
 
-    self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    self = NAUTILUS_GRID_VIEW (user_data);
     event_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
     button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
     modifiers = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (gesture));
@@ -288,7 +288,7 @@ on_click_pressed (GtkGestureClick *gesture,
     gtk_widget_translate_coordinates (event_widget, GTK_WIDGET (self),
                                       x, y,
                                       &view_x, &view_y);
-    if (NAUTILUS_IS_VIEW_ICON_ITEM_UI (event_widget))
+    if (NAUTILUS_IS_GRID_VIEW_ITEM_UI (event_widget))
     {
         self->activate_on_release = (self->single_click_mode &&
                                      button == GDK_BUTTON_PRIMARY &&
@@ -308,7 +308,7 @@ on_click_pressed (GtkGestureClick *gesture,
             guint position;
 
             model = nautilus_files_model_view_get_model (NAUTILUS_FILES_MODEL_VIEW (self));
-            item_model = nautilus_view_icon_item_ui_get_model (NAUTILUS_VIEW_ICON_ITEM_UI (event_widget));
+            item_model = nautilus_grid_view_item_ui_get_model (NAUTILUS_GRID_VIEW_ITEM_UI (event_widget));
             position = nautilus_view_model_get_index (model, item_model);
             if (!gtk_selection_model_is_selected (GTK_SELECTION_MODEL (model), position))
             {
@@ -358,7 +358,7 @@ on_click_released (GtkGestureClick *gesture,
                    gdouble          y,
                    gpointer         user_data)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (user_data);
 
     if (self->activate_on_release)
     {
@@ -372,7 +372,7 @@ static void
 on_click_stopped (GtkGestureClick *gesture,
                   gpointer         user_data)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (user_data);
 
     self->activate_on_release = FALSE;
 }
@@ -383,18 +383,18 @@ on_longpress_gesture_pressed_callback (GtkGestureLongPress *gesture,
                                        gdouble              y,
                                        gpointer             user_data)
 {
-    NautilusViewIconController *self;
+    NautilusGridView *self;
     GtkWidget *event_widget;
     gdouble view_x;
     gdouble view_y;
 
-    self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    self = NAUTILUS_GRID_VIEW (user_data);
     event_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
 
     gtk_widget_translate_coordinates (event_widget,
                                       GTK_WIDGET (self),
                                       x, y, &view_x, &view_y);
-    if (NAUTILUS_IS_VIEW_ICON_ITEM_UI (event_widget))
+    if (NAUTILUS_IS_GRID_VIEW_ITEM_UI (event_widget))
     {
         nautilus_files_view_pop_up_selection_context_menu (NAUTILUS_FILES_VIEW (self),
                                                            view_x, view_y);
@@ -411,15 +411,15 @@ on_longpress_gesture_pressed_callback (GtkGestureLongPress *gesture,
 static void
 real_sort_directories_first_changed (NautilusFilesView *files_view)
 {
-    NautilusViewIconController *self;
+    NautilusGridView *self;
     NautilusViewModel *model;
     g_autoptr (GtkCustomSorter) sorter = NULL;
 
-    self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    self = NAUTILUS_GRID_VIEW (files_view);
     self->directories_first = nautilus_files_view_should_sort_directories_first (NAUTILUS_FILES_VIEW (self));
 
     model = nautilus_files_model_view_get_model (NAUTILUS_FILES_MODEL_VIEW (self));
-    sorter = gtk_custom_sorter_new (nautilus_view_icon_controller_sort, self, NULL);
+    sorter = gtk_custom_sorter_new (nautilus_grid_view_sort, self, NULL);
     nautilus_view_model_set_sorter (model, GTK_SORTER (sorter));
 }
 
@@ -429,7 +429,7 @@ action_sort_order_changed (GSimpleAction *action,
                            gpointer       user_data)
 {
     const gchar *target_name;
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (user_data);
     NautilusViewModel *model;
     g_autoptr (GtkCustomSorter) sorter = NULL;
 
@@ -442,7 +442,7 @@ action_sort_order_changed (GSimpleAction *action,
     g_variant_get (value, "(&sb)", &target_name, &self->reversed);
     self->sort_type = get_sorts_type_from_metadata_text (target_name);
 
-    sorter = gtk_custom_sorter_new (nautilus_view_icon_controller_sort, self, NULL);
+    sorter = gtk_custom_sorter_new (nautilus_grid_view_sort, self, NULL);
     model = nautilus_files_model_view_get_model (NAUTILUS_FILES_MODEL_VIEW (self));
     nautilus_view_model_set_sorter (model, GTK_SORTER (sorter));
     set_directory_sort_metadata (nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (self)),
@@ -463,7 +463,7 @@ action_zoom_to_level (GSimpleAction *action,
                       GVariant      *state,
                       gpointer       user_data)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (user_data);
     int zoom_level;
 
     zoom_level = g_variant_get_int32 (state);
@@ -480,11 +480,11 @@ action_zoom_to_level (GSimpleAction *action,
 }
 
 static void
-on_captions_preferences_changed (NautilusViewIconController *self)
+on_captions_preferences_changed (NautilusGridView *self)
 {
     set_captions_from_preferences (self);
 
-    /* Hack: this relies on the assumption that NautilusViewIconItemUi updates
+    /* Hack: this relies on the assumption that NautilusGridViewItemUi updates
      * captions whenever the icon size is set (even if it's the same value). */
     nautilus_files_model_view_set_icon_size (NAUTILUS_FILES_MODEL_VIEW (self),
                                              get_icon_size_for_zoom_level (self->zoom_level));
@@ -493,13 +493,13 @@ on_captions_preferences_changed (NautilusViewIconController *self)
 static void
 dispose (GObject *object)
 {
-    G_OBJECT_CLASS (nautilus_view_icon_controller_parent_class)->dispose (object);
+    G_OBJECT_CLASS (nautilus_grid_view_parent_class)->dispose (object);
 }
 
 static void
 finalize (GObject *object)
 {
-    G_OBJECT_CLASS (nautilus_view_icon_controller_parent_class)->finalize (object);
+    G_OBJECT_CLASS (nautilus_grid_view_parent_class)->finalize (object);
 }
 
 static void
@@ -514,11 +514,11 @@ bind_item_ui (GtkSignalListItemFactory *factory,
     item_model = listitem_get_view_item (listitem);
     g_return_if_fail (item_model != NULL);
 
-    nautilus_view_icon_item_ui_set_model (NAUTILUS_VIEW_ICON_ITEM_UI (item_ui),
+    nautilus_grid_view_item_ui_set_model (NAUTILUS_GRID_VIEW_ITEM_UI (item_ui),
                                           item_model);
     nautilus_view_item_model_set_item_ui (item_model, item_ui);
 
-    if (nautilus_view_icon_item_ui_once (NAUTILUS_VIEW_ICON_ITEM_UI (item_ui)))
+    if (nautilus_grid_view_item_ui_once (NAUTILUS_GRID_VIEW_ITEM_UI (item_ui)))
     {
         GtkWidget *parent;
 
@@ -540,13 +540,13 @@ unbind_item_ui (GtkSignalListItemFactory *factory,
                 GtkListItem              *listitem,
                 gpointer                  user_data)
 {
-    NautilusViewIconItemUi *item_ui;
+    NautilusGridViewItemUi *item_ui;
     NautilusViewItemModel *item_model;
 
-    item_ui = NAUTILUS_VIEW_ICON_ITEM_UI (gtk_list_item_get_child (listitem));
+    item_ui = NAUTILUS_GRID_VIEW_ITEM_UI (gtk_list_item_get_child (listitem));
     item_model = listitem_get_view_item (listitem);
 
-    nautilus_view_icon_item_ui_set_model (item_ui, NULL);
+    nautilus_grid_view_item_ui_set_model (item_ui, NULL);
     /* item may be NULL when row has just been destroyed. */
     if (item_model != NULL)
     {
@@ -559,11 +559,11 @@ setup_item_ui (GtkSignalListItemFactory *factory,
                GtkListItem              *listitem,
                gpointer                  user_data)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
-    NautilusViewIconItemUi *item_ui;
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (user_data);
+    NautilusGridViewItemUi *item_ui;
     GtkEventController *controller;
 
-    item_ui = nautilus_view_icon_item_ui_new ();
+    item_ui = nautilus_grid_view_item_ui_new ();
     nautilus_view_item_ui_set_caption_attributes (item_ui, self->caption_attributes);
     gtk_list_item_set_child (listitem, GTK_WIDGET (item_ui));
 
@@ -583,7 +583,7 @@ setup_item_ui (GtkSignalListItemFactory *factory,
 }
 
 static GtkGridView *
-create_view_ui (NautilusViewIconController *self)
+create_view_ui (NautilusGridView *self)
 {
     NautilusViewModel *model;
     GtkListItemFactory *factory;
@@ -620,7 +620,7 @@ const GActionEntry view_icon_actions[] =
 };
 
 static void
-nautilus_view_icon_controller_class_init (NautilusViewIconControllerClass *klass)
+nautilus_grid_view_class_init (NautilusGridViewClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
     NautilusFilesViewClass *files_view_class = NAUTILUS_FILES_VIEW_CLASS (klass);
@@ -644,7 +644,7 @@ nautilus_view_icon_controller_class_init (NautilusViewIconControllerClass *klass
 }
 
 static void
-nautilus_view_icon_controller_init (NautilusViewIconController *self)
+nautilus_grid_view_init (NautilusGridView *self)
 {
     GtkWidget *content_widget;
     GtkEventController *controller;
@@ -697,10 +697,10 @@ nautilus_view_icon_controller_init (NautilusViewIconController *self)
                                         "zoom-to-level", g_variant_new_int32 (self->zoom_level));
 }
 
-NautilusViewIconController *
-nautilus_view_icon_controller_new (NautilusWindowSlot *slot)
+NautilusGridView *
+nautilus_grid_view_new (NautilusWindowSlot *slot)
 {
-    return g_object_new (NAUTILUS_TYPE_VIEW_ICON_CONTROLLER,
+    return g_object_new (NAUTILUS_TYPE_GRID_VIEW,
                          "window-slot", slot,
                          NULL);
 }
diff --git a/src/nautilus-grid-view.h b/src/nautilus-grid-view.h
new file mode 100644
index 000000000..61f7bcb8b
--- /dev/null
+++ b/src/nautilus-grid-view.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "nautilus-files-model-view.h"
+#include "nautilus-window-slot.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_GRID_VIEW (nautilus_grid_view_get_type())
+
+G_DECLARE_FINAL_TYPE (NautilusGridView, nautilus_grid_view, NAUTILUS, GRID_VIEW, NautilusFilesModelView)
+
+NautilusGridView *nautilus_grid_view_new (NautilusWindowSlot *slot);
+
+G_END_DECLS
diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml
index d27f7b5ff..888d0c294 100644
--- a/src/resources/nautilus.gresource.xml
+++ b/src/resources/nautilus.gresource.xml
@@ -25,7 +25,7 @@
     <file>ui/nautilus-file-conflict-dialog.ui</file>
     <file>ui/nautilus-files-view-select-items.ui</file>
     <file>ui/nautilus-operations-ui-manager-request-passphrase.ui</file>
-    <file>ui/nautilus-view-icon-item-ui.ui</file>
+    <file>ui/nautilus-grid-view-item-ui.ui</file>
     <file alias="gtk/ui/nautilusgtksidebarrow.ui">../gtk/nautilusgtksidebarrow.ui</file>
     <file alias="gtk/ui/nautilusgtkplacesview.ui">../gtk/nautilusgtkplacesview.ui</file>
     <file alias="gtk/ui/nautilusgtkplacesviewrow.ui">../gtk/nautilusgtkplacesviewrow.ui</file>
diff --git a/src/resources/ui/nautilus-view-icon-item-ui.ui b/src/resources/ui/nautilus-grid-view-item-ui.ui
similarity index 98%
rename from src/resources/ui/nautilus-view-icon-item-ui.ui
rename to src/resources/ui/nautilus-grid-view-item-ui.ui
index 0b0f18d26..7673eb084 100644
--- a/src/resources/ui/nautilus-view-icon-item-ui.ui
+++ b/src/resources/ui/nautilus-grid-view-item-ui.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <template class="NautilusViewIconItemUi" parent="GtkBox">
+  <template class="NautilusGridViewItemUi" parent="GtkBox">
     <child>
       <object class="AdwClamp">
         <property name="maximum-size">0</property>


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