From ee5ff400e7d279407f1e50af5f40d9706e27072f Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 13 Jun 2023 10:04:44 -0700 Subject: [PATCH] libsysprof-gtk: use shortcut controller for actions --- src/libsysprof-gtk/sysprof-callgraph-view.c | 27 ------------------- src/libsysprof-gtk/sysprof-callgraph-view.ui | 28 ++++++++++++++++---- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/libsysprof-gtk/sysprof-callgraph-view.c b/src/libsysprof-gtk/sysprof-callgraph-view.c index c6bbfd1a..7c0f66eb 100644 --- a/src/libsysprof-gtk/sysprof-callgraph-view.c +++ b/src/libsysprof-gtk/sysprof-callgraph-view.c @@ -227,32 +227,6 @@ functions_selection_changed_cb (SysprofCallgraphView *self, } } -static gboolean -sysprof_callgraph_view_key_pressed_cb (GtkTreeExpander *expander, - guint keyval, - guint keycode, - GdkModifierType state, - GtkEventControllerKey *controller) -{ - GtkTreeListRow *row; - - g_assert (GTK_IS_TREE_EXPANDER (expander)); - g_assert (GTK_IS_EVENT_CONTROLLER_KEY (controller)); - - row = gtk_tree_expander_get_list_row (expander); - - if (keyval == GDK_KEY_space) - gtk_tree_list_row_set_expanded (row, !gtk_tree_list_row_get_expanded (row)); - else if (keyval == GDK_KEY_Right) - gtk_tree_list_row_set_expanded (row, TRUE); - else if (keyval == GDK_KEY_Left) - gtk_tree_list_row_set_expanded (row, FALSE); - else - return FALSE; - - return TRUE; -} - static char * format_time_offset (gpointer cell) { @@ -385,7 +359,6 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass) gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, scrolled_window); gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, traceable_column_view); gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, traceables_column_view); - gtk_widget_class_bind_template_callback (widget_class, sysprof_callgraph_view_key_pressed_cb); gtk_widget_class_bind_template_callback (widget_class, format_time_offset); klass->augment_size = GLIB_SIZEOF_VOID_P; diff --git a/src/libsysprof-gtk/sysprof-callgraph-view.ui b/src/libsysprof-gtk/sysprof-callgraph-view.ui index b3bca3af..5c833fcb 100644 --- a/src/libsysprof-gtk/sysprof-callgraph-view.ui +++ b/src/libsysprof-gtk/sysprof-callgraph-view.ui @@ -124,14 +124,32 @@