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




commit 8c701bf52709b2c959fbaa695e8ddbfd15e08a8e
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 029a68c25..7fb779508 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -980,6 +980,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]