From cbef6a9258eed83d697acc0867ca05bea467d8df Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 29 Mar 2023 06:01:26 +0200 Subject: [PATCH] listbase: Select via action Instead of directly calling select_item(), trigger the select-item action of the focused child. We do this convoluted calling into the widget because that way GtkListItem::selectable gets respected, which is what one would expect. Plus, this code is usually triggered via keybindings, and this way the ListBase keybindings work identical to the ListItem keybindings. --- gtk/gtklistbase.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c index 3316145484..c0e2448279 100644 --- a/gtk/gtklistbase.c +++ b/gtk/gtklistbase.c @@ -499,7 +499,15 @@ gtk_list_base_grab_focus_on_item (GtkListBase *self, return FALSE; if (select) - gtk_list_base_select_item (self, pos, modify, extend); + { + tile = gtk_list_item_manager_get_nth (priv->item_manager, pos, NULL); + + /* We do this convoluted calling into the widget because that way + * GtkListItem::selectable gets respected, which is what one would expect. + */ + g_assert (tile->widget); + gtk_widget_activate_action (tile->widget, "listitem.select", "(bb)", modify, extend); + } return TRUE; } -- 2.30.2