forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
a0c489048a
commit
71c29bfcff
@ -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);
|
||||
|
||||
@ -569,6 +570,12 @@ gtk_list_item_manager_ensure_items (GtkListItemManager *self,
|
||||
gtk_list_item_manager_release_list_item (self, NULL, widget);
|
||||
}
|
||||
|
||||
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,
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user