[nautilus/wip/antoniof/flow-box-preparation: 9/13] view-icon-controller: Split child creation in two steps
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/flow-box-preparation: 9/13] view-icon-controller: Split child creation in two steps
- Date: Mon, 25 Oct 2021 19:17:13 +0000 (UTC)
commit 6a0bc14c9935a62d3d5da4a80c35ce599714dbdd
Author: António Fernandes <antoniof gnome org>
Date: Sat Aug 28 21:22:55 2021 +0100
view-icon-controller: Split child creation in two steps
This mimics GtkSignalListItemFactory::setup and ::bind signals.
Adopting this paradigm is going to help us port to GtkGridView right
after the port to GTK 4.
src/nautilus-view-icon-controller.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index 11cc14d20..7a7609b93 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -1025,19 +1025,35 @@ on_ui_selected_children_changed (GtkFlowBox *box,
nautilus_files_view_notify_selection_changed (NAUTILUS_FILES_VIEW (self));
}
+static void
+bind_item_ui (GtkWidget **child,
+ NautilusViewItemModel *item_model,
+ gpointer user_data)
+{
+ nautilus_view_icon_item_ui_set_model (NAUTILUS_VIEW_ICON_ITEM_UI (*child),
+ item_model);
+ nautilus_view_item_model_set_item_ui (item_model, *child);
+}
+
+static void
+setup_item_ui (GtkWidget **child,
+ gpointer user_data)
+{
+ *child = GTK_WIDGET (nautilus_view_icon_item_ui_new ());
+ gtk_widget_show_all (*child);
+}
+
static GtkWidget *
create_widget_func (gpointer item,
gpointer user_data)
{
NautilusViewItemModel *item_model = NAUTILUS_VIEW_ITEM_MODEL (item);
- NautilusViewIconItemUi *child;
+ GtkWidget *child = NULL;
- child = nautilus_view_icon_item_ui_new ();
- nautilus_view_icon_item_ui_set_model (child, item_model);
- nautilus_view_item_model_set_item_ui (item_model, GTK_WIDGET (child));
- gtk_widget_show_all (GTK_WIDGET (child));
+ setup_item_ui (&child, user_data);
+ bind_item_ui (&child, item_model, user_data);
- return GTK_WIDGET (child);
+ return child;
}
static GtkFlowBox *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]