[nautilus/wip/antoniof/flow-box-preparation: 10/20] view-icon-controller: Find item for file using optimized method



commit 209d92f08fb6b9a8aef5afd95836e1dacdbb5e52
Author: AntĂłnio Fernandes <antoniof gnome org>
Date:   Tue Aug 17 20:38:16 2021 +0100

    view-icon-controller: Find item for file using optimized method

 src/nautilus-view-icon-controller.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index f487cef2c..4aee06e5c 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -314,19 +314,12 @@ real_remove_file (NautilusFilesView *files_view,
                   NautilusDirectory *directory)
 {
     NautilusViewIconController *self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
-    NautilusFile *current_file;
-    NautilusViewItemModel *current_item_model;
-    guint i = 0;
+    NautilusViewItemModel *item_model;
 
-    while ((current_item_model = NAUTILUS_VIEW_ITEM_MODEL (g_list_model_get_item (G_LIST_MODEL 
(self->model), i))))
+    item_model = nautilus_view_model_get_item_from_file (self->model, file);
+    if (item_model != NULL)
     {
-        current_file = nautilus_view_item_model_get_file (current_item_model);
-        if (current_file == file)
-        {
-            nautilus_view_model_remove_item (self->model, current_item_model);
-            break;
-        }
-        i++;
+        nautilus_view_model_remove_item (self->model, item_model);
     }
 }
 


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