[nautilus/wip/antoniof/flow-box-preparation: 4/18] 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: 4/18] view-model: Use GListStore::find()
- Date: Wed, 1 Dec 2021 16:41:09 +0000 (UTC)
commit 14a11bb64d06f50408352e5f289c717b415fc437
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 | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
---
diff --git a/src/nautilus-view-model.c b/src/nautilus-view-model.c
index e2c5caeca..5554f607d 100644
--- a/src/nautilus-view-model.c
+++ b/src/nautilus-view-model.c
@@ -266,27 +266,14 @@ 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 index;
- if (item_model != NULL)
+ if (g_list_store_find (self->internal_model, item, &index))
{
NautilusFile *file;
- file = nautilus_view_item_model_get_file (item_model);
- g_list_store_remove (self->internal_model, i);
+ file = nautilus_view_item_model_get_file (item);
+ g_list_store_remove (self->internal_model, index);
g_hash_table_remove (self->map_files_to_model, file);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]