treeexpander: Scroll to expanded item

If the anchor is below the expanded item, the expanded item will
go out of view if there are sufficient children items.  This is not
ideal, so make sure to scroll to the item to ensure it remains in
view.
This commit is contained in:
Corey Berla 2022-11-29 20:00:48 -08:00
parent 7eac27e5ee
commit fdfd76774e

View File

@ -503,11 +503,17 @@ gtk_tree_expander_toggle_expand (GtkWidget *widget,
GVariant *parameter)
{
GtkTreeExpander *self = GTK_TREE_EXPANDER (widget);
gboolean expand;
if (self->list_row == NULL)
return;
gtk_tree_list_row_set_expanded (self->list_row, !gtk_tree_list_row_get_expanded (self->list_row));
expand = !gtk_tree_list_row_get_expanded (self->list_row);
if (expand)
gtk_widget_activate_action (widget, "listitem.scroll-to", NULL);
gtk_tree_list_row_set_expanded (self->list_row, expand);
}
static gboolean