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




commit 73f94e34ece103b6b9fa59987b7db49333533ef5
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 09f45ec4f..38b4e746a 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -981,6 +981,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]