sysprof: add expand/collapse actions

This way we can work with columnview and listview.
This commit is contained in:
Christian Hergert
2023-07-19 15:40:42 -07:00
parent 3ccf219ec3
commit 72f84c2c64

View File

@ -212,10 +212,36 @@ sysprof_tree_expander_click_cancel_cb (SysprofTreeExpander *self,
gtk_gesture_set_state (GTK_GESTURE (click), GTK_EVENT_SEQUENCE_CLAIMED);
}
static void
sysprof_tree_expander_expand (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
SysprofTreeExpander *self = (SysprofTreeExpander *)widget;
g_assert (SYSPROF_IS_TREE_EXPANDER (self));
if (self->list_row != NULL)
gtk_tree_list_row_set_expanded (self->list_row, TRUE);
}
static void
sysprof_tree_expander_collapse (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
SysprofTreeExpander *self = (SysprofTreeExpander *)widget;
g_assert (SYSPROF_IS_TREE_EXPANDER (self));
if (self->list_row != NULL)
gtk_tree_list_row_set_expanded (self->list_row, FALSE);
}
static void
sysprof_tree_expander_toggle_expand (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
const char *action_name,
GVariant *parameter)
{
SysprofTreeExpander *self = (SysprofTreeExpander *)widget;
@ -424,6 +450,8 @@ sysprof_tree_expander_class_init (SysprofTreeExpanderClass *klass)
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
gtk_widget_class_install_action (widget_class, "listitem.toggle-expand", NULL, sysprof_tree_expander_toggle_expand);
gtk_widget_class_install_action (widget_class, "listitem.collapse", NULL, sysprof_tree_expander_collapse);
gtk_widget_class_install_action (widget_class, "listitem.expand", NULL, sysprof_tree_expander_expand);
}
static void