diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-06-06 08:34:46 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-06-06 08:36:11 -0400 |
commit | 71c29bfcff1f65b156250806e3b3520db8acabad (patch) | |
tree | 0da7b3345c1a7646538617ce4a235a04b1988bdc /gtk/gtklistitemmanager.c | |
parent | a0c489048a412d8611b481c127374188899f7fe8 (diff) | |
download | gtk+-71c29bfcff1f65b156250806e3b3520db8acabad.tar.gz |
listitemmanager: Handle selection-changes properly
The selection model will only emit one of items-changed
or selection-changed, so when we handle an items-changed,
we must assume that selection state may have changed for
any of the newly added items.
This fixes lingering selection state in the visible range
if you change the sorting of the colors demo.
Fixes: #2827
Diffstat (limited to 'gtk/gtklistitemmanager.c')
-rw-r--r-- | gtk/gtklistitemmanager.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gtk/gtklistitemmanager.c b/gtk/gtklistitemmanager.c index ef0570d45a..e08592bca8 100644 --- a/gtk/gtklistitemmanager.c +++ b/gtk/gtklistitemmanager.c @@ -395,6 +395,7 @@ gtk_list_item_manager_add_items (GtkListItemManager *self, if (item == NULL || item->widget) item = gtk_rb_tree_insert_before (self->items, item); + item->n_items += n_items; gtk_rb_tree_node_mark_dirty (item); @@ -570,6 +571,12 @@ gtk_list_item_manager_ensure_items (GtkListItemManager *self, } static void +gtk_list_item_manager_model_selection_changed_cb (GListModel *model, + guint position, + guint n_items, + GtkListItemManager *self); + +static void gtk_list_item_manager_model_items_changed_cb (GListModel *model, guint position, guint removed, @@ -735,6 +742,8 @@ gtk_list_item_manager_model_items_changed_cb (GListModel *model, g_hash_table_unref (change); + gtk_list_item_manager_model_selection_changed_cb (model, position, added, self); + gtk_widget_queue_resize (self->widget); } |