[nautilus/wip/antoniof/flow-box-preparation: 30/68] view-model: Use GListStore::find()
- From: António Fernandes <antoniof src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [nautilus/wip/antoniof/flow-box-preparation: 30/68] view-model: Use GListStore::find()
 
- Date: Wed, 29 Dec 2021 11:41:33 +0000 (UTC)
 
commit cbe1b3058c810d34fa0fbcfcfdd83727f5682583
Author: António Fernandes <antoniof gnome org>
Date:   Tue Aug 17 21:22:52 2021 +0100
    view-model: Use GListStore::find()
    
    It's functionally equivalent, but more compact.
 src/nautilus-view-model.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-view-model.c b/src/nautilus-view-model.c
index e2c5caeca..84c40302d 100644
--- a/src/nautilus-view-model.c
+++ b/src/nautilus-view-model.c
@@ -266,26 +266,13 @@ void
 nautilus_view_model_remove_item (NautilusViewModel     *self,
                                  NautilusViewItemModel *item)
 {
-    NautilusViewItemModel *item_model;
-    gint i;
-
-    i = 0;
-    item_model = NULL;
-    while ((item_model = g_list_model_get_item (G_LIST_MODEL (self->internal_model), i)))
-    {
-        if (item_model == item)
-        {
-            break;
-        }
-
-        i++;
-    }
+    guint i;
 
-    if (item_model != NULL)
+    if (g_list_store_find (self->internal_model, item, &i))
     {
         NautilusFile *file;
 
-        file = nautilus_view_item_model_get_file (item_model);
+        file = nautilus_view_item_model_get_file (item);
         g_list_store_remove (self->internal_model, i);
         g_hash_table_remove (self->map_files_to_model, file);
     }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]