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




commit d821cdb354ee3265f471cb46afbbcf5f1a20b34e
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 f4d9ee14a..5c817589b 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]