[nautilus/wip/antoniof/new-list-view-without-expanders: 9/17] view-icon-controller: Rename to NautilusGridView




commit 20dfa98c7251648ccdfcd3ca845a894cb35e3af8
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} | 122 ++++++++++-----------
 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, 148 insertions(+), 148 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 141a20ba4..4124d0c4c 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 9de16c27a..12683a2c6 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -86,7 +86,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"
 
@@ -3718,7 +3718,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
@@ -9607,7 +9607,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 d9b35b1a4..e0099e18e 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;
 
@@ -25,16 +25,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;
 
@@ -51,7 +51,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;
@@ -106,7 +106,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);
 }
@@ -114,7 +114,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);
 }
@@ -131,7 +131,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;
@@ -162,13 +162,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);
 
@@ -181,9 +181,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));
@@ -192,10 +192,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;
@@ -204,7 +204,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;
 }
@@ -212,7 +212,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;
 }
@@ -221,7 +221,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",
@@ -230,7 +230,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;
 
@@ -243,7 +243,7 @@ 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);
 }
 
@@ -252,8 +252,8 @@ real_click_policy_changed (NautilusFilesView *files_view)
  * or open its context menu. This helper should be used in these situations if
  * it's desirable to act on a multi-item selection, because it preserves it. */
 static void
-select_single_item_if_not_selected (NautilusViewIconController *self,
-                                    NautilusViewItemModel      *item)
+select_single_item_if_not_selected (NautilusGridView      *self,
+                                    NautilusViewItemModel *item)
 {
     NautilusViewModel *model;
     guint position;
@@ -267,8 +267,8 @@ select_single_item_if_not_selected (NautilusViewIconController *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;
@@ -290,7 +290,7 @@ on_item_click_pressed (GtkGestureClick *gesture,
                        gdouble          y,
                        gpointer         user_data)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (user_data);
     GtkWidget *event_widget;
     NautilusViewItemModel *item_model;
     guint button;
@@ -298,7 +298,7 @@ on_item_click_pressed (GtkGestureClick *gesture,
     gboolean selection_mode;
 
     event_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
-    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));
     button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
     modifiers = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (gesture));
     selection_mode = (modifiers & (GDK_CONTROL_MASK | GDK_SHIFT_MASK));
@@ -347,7 +347,7 @@ on_item_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)
     {
@@ -358,7 +358,7 @@ on_item_click_released (GtkGestureClick *gesture,
 
         model = nautilus_files_model_view_get_model (NAUTILUS_FILES_MODEL_VIEW (self));
         event_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
-        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));
         i = nautilus_view_model_get_index (model, item_model);
 
         /* Antecipate selection, enforcing single selection of target item. */
@@ -375,7 +375,7 @@ static void
 on_item_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;
     self->deny_background_click = FALSE;
@@ -388,7 +388,7 @@ on_view_click_pressed (GtkGestureClick *gesture,
                        gdouble          y,
                        gpointer         user_data)
 {
-    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+    NautilusGridView *self = NAUTILUS_GRID_VIEW (user_data);
     guint button;
     GdkModifierType modifiers;
     gboolean selection_mode;
@@ -431,18 +431,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);
@@ -459,15 +459,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));
 }
 
@@ -477,7 +477,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;
 
@@ -490,7 +490,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)),
@@ -511,7 +511,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);
@@ -528,11 +528,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));
@@ -541,13 +541,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
@@ -561,11 +561,11 @@ bind_item_ui (GtkSignalListItemFactory *factory,
     item_ui = gtk_list_item_get_child (listitem);
     item_model = NAUTILUS_VIEW_ITEM_MODEL (gtk_list_item_get_item (listitem));
 
-    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;
 
@@ -587,13 +587,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 = NAUTILUS_VIEW_ITEM_MODEL (gtk_list_item_get_item (listitem));
 
-    nautilus_view_icon_item_ui_set_model (item_ui, NULL);
+    nautilus_grid_view_item_ui_set_model (item_ui, NULL);
     nautilus_view_item_model_set_item_ui (item_model, NULL);
 }
 
@@ -602,11 +602,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));
 
@@ -626,7 +626,7 @@ setup_item_ui (GtkSignalListItemFactory *factory,
 }
 
 static GtkGridView *
-create_view_ui (NautilusViewIconController *self)
+create_view_ui (NautilusGridView *self)
 {
     NautilusViewModel *model;
     GtkListItemFactory *factory;
@@ -663,7 +663,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);
@@ -687,7 +687,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;
@@ -736,10 +736,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 304814f75..34419aa27 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]