[nautilus/wip/antoniof/flow-box-preparation: 5/14] view-icon-controller: Implement .select_first()




commit 38f088b21a85a1241702a119266aa0c458d4c76b
Author: António Fernandes <antoniof gnome org>
Date:   Tue Dec 7 01:24:39 2021 +0000

    view-icon-controller: Implement .select_first()

 src/nautilus-view-icon-controller.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index 60d9e0f1b..fd7b59a1d 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -916,6 +916,15 @@ real_get_icon (NautilusFilesView *files_view)
 static void
 real_select_first (NautilusFilesView *files_view)
 {
+    NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+    NautilusViewItemModel *item;
+    NautilusFile *file;
+    g_autoptr (GList) selection = NULL;
+
+    item = NAUTILUS_VIEW_ITEM_MODEL (g_list_model_get_item (G_LIST_MODEL (self->model), 0));
+    file = nautilus_view_item_model_get_file (item);
+    selection = g_list_prepend (selection, file);
+    nautilus_view_set_selection (NAUTILUS_VIEW (files_view), selection);
 }
 
 static void


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