From: Benjamin Otte Date: Wed, 29 Mar 2023 04:01:26 +0000 (+0200) Subject: listbase: Select via action X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~484^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cbef6a9258eed83d697acc0867ca05bea467d8df;p=gtk4.git 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. --- 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; }