summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-04-22 05:54:58 +0000
committerMatthias Clasen <mclasen@redhat.com>2023-04-22 05:54:58 +0000
commit6d0659a83ad4b5a74e551ab83a7f8a256f0dd2c7 (patch)
treeb69bdba4dcb1a05a924c4702a757a3366e4ac6c7
parentb579a39a47cb668bef2e03f4844f0b8e371f3ee5 (diff)
parent0ce6bc677e339b2af213377773e184674cb45c87 (diff)
downloadgtk+-6d0659a83ad4b5a74e551ab83a7f8a256f0dd2c7.tar.gz
Merge branch 'gtkfilesystemmodel-emit-items-changed-on-modifying-attributes' into 'main'
filesystemmodel: Emit items-changed when modifying attributes Closes #5758 See merge request GNOME/gtk!5853
-rw-r--r--gtk/gtkfilesystemmodel.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index 1dc1da5007..47129f10d3 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -384,6 +384,7 @@ gtk_file_system_model_refilter_all (GtkFileSystemModel *model)
for (i = 0; i < model->files->len; i++)
node_compute_visibility_and_filters (model, i);
+ g_list_model_items_changed (G_LIST_MODEL (model), 0, model->files->len, model->files->len);
model->filter_on_thaw = FALSE;
thaw_updates (model);
}
@@ -408,6 +409,7 @@ thaw_updates (GtkFileSystemModel *model)
if (stuff_added)
{
guint i;
+ guint changed_idx = G_MAXUINT;
for (i = 0; i < model->files->len; i++)
{
@@ -415,9 +417,17 @@ thaw_updates (GtkFileSystemModel *model)
if (!node->frozen_add)
continue;
+
node->frozen_add = FALSE;
node_compute_visibility_and_filters (model, i);
+ if (changed_idx == G_MAXUINT)
+ changed_idx = i;
}
+
+ if (changed_idx != G_MAXUINT)
+ g_list_model_items_changed (G_LIST_MODEL (model), changed_idx,
+ model->files->len - changed_idx,
+ model->files->len - changed_idx);
}
}
@@ -448,9 +458,10 @@ add_file (GtkFileSystemModel *model,
position = model->files->len - 1;
if (!model->frozen)
- node_compute_visibility_and_filters (model, position);
-
- g_list_model_items_changed (G_LIST_MODEL (model), position, 0, 1);
+ {
+ node_compute_visibility_and_filters (model, position);
+ g_list_model_items_changed (G_LIST_MODEL (model), position, 0, 1);
+ }
}
static void