[nautilus/wip/antoniof/new-list-view-continuation: 13/19] view-icon-controller: Rename to NautilusGridView
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/new-list-view-continuation: 13/19] view-icon-controller: Rename to NautilusGridView
- Date: Sat, 9 Apr 2022 16:57:42 +0000 (UTC)
commit a1b548cf0c19bf24a1e062d83755a69b1539e678
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} | 124 ++++++++++-----------
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, 149 insertions(+), 149 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 51a3f6269..28bf03c96 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,7 +25,7 @@ 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 inline NautilusViewItemModel *
model_get_item (GListModel *model,
@@ -49,11 +49,11 @@ listitem_get_item (GtkListItem *listitem)
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;
@@ -70,7 +70,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;
@@ -125,7 +125,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);
}
@@ -133,7 +133,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);
}
@@ -150,7 +150,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;
@@ -181,8 +181,8 @@ set_captions_from_preferences (NautilusViewIconController *self)
}
static void
-set_icon_size (NautilusViewIconController *self,
- gint icon_size)
+set_icon_size (NautilusGridView *self,
+ gint icon_size)
{
GListModel *model;
guint n_items;
@@ -200,13 +200,13 @@ set_icon_size (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);
@@ -218,9 +218,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));
@@ -229,10 +229,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;
@@ -241,7 +241,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;
}
@@ -249,7 +249,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;
}
@@ -258,7 +258,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",
@@ -267,7 +267,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;
@@ -280,13 +280,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;
@@ -308,7 +308,7 @@ on_click_pressed (GtkGestureClick *gesture,
gdouble y,
gpointer user_data)
{
- NautilusViewIconController *self;
+ NautilusGridView *self;
GtkWidget *event_widget;
guint button;
GdkModifierType modifiers;
@@ -316,7 +316,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));
@@ -326,7 +326,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 &&
@@ -346,7 +346,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))
{
@@ -396,7 +396,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)
{
@@ -410,7 +410,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;
}
@@ -421,18 +421,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);
@@ -449,15 +449,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));
}
@@ -467,7 +467,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;
@@ -480,7 +480,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)),
@@ -499,7 +499,7 @@ real_get_view_id (NautilusFilesView *files_view)
static GIcon *
real_get_icon (NautilusFilesView *files_view)
{
- NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+ NautilusGridView *self = NAUTILUS_GRID_VIEW (files_view);
return self->view_icon;
}
@@ -509,7 +509,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);
@@ -526,11 +526,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). */
set_icon_size (self, get_icon_size_for_zoom_level (self->zoom_level));
}
@@ -538,13 +538,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
@@ -559,11 +559,11 @@ bind_item_ui (GtkSignalListItemFactory *factory,
item_model = listitem_get_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;
@@ -585,13 +585,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_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)
{
@@ -604,11 +604,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));
@@ -628,7 +628,7 @@ setup_item_ui (GtkSignalListItemFactory *factory,
}
static GtkGridView *
-create_view_ui (NautilusViewIconController *self)
+create_view_ui (NautilusGridView *self)
{
NautilusViewModel *model;
GtkListItemFactory *factory;
@@ -665,7 +665,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);
@@ -690,7 +690,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;
@@ -745,10 +745,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]