diff --git a/src/libsysprof-gtk/sysprof-callgraph-view.c b/src/libsysprof-gtk/sysprof-callgraph-view.c index eb9c64e5..2b683fe2 100644 --- a/src/libsysprof-gtk/sysprof-callgraph-view.c +++ b/src/libsysprof-gtk/sysprof-callgraph-view.c @@ -232,6 +232,54 @@ functions_selection_changed_cb (SysprofCallgraphView *self, } } +static void +traceable_activate_cb (SysprofCallgraphView *self, + guint position, + GtkColumnView *column_view) +{ + g_autoptr(SysprofSymbol) symbol = NULL; + GtkSelectionModel *model; + + g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self)); + g_assert (GTK_IS_COLUMN_VIEW (column_view)); + + if ((model = gtk_column_view_get_model (column_view)) && + (symbol = g_list_model_get_item (G_LIST_MODEL (model), position))) + { + GListModel *functions = G_LIST_MODEL (gtk_column_view_get_model (self->functions_column_view)); + guint n_items = g_list_model_get_n_items (functions); + + for (guint i = 0; i < n_items; i++) + { + g_autoptr(SysprofCallgraphSymbol) callsym = g_list_model_get_item (functions, i); + SysprofSymbol *cur = sysprof_callgraph_symbol_get_symbol (callsym); + + if (sysprof_symbol_equal (cur, symbol)) + { + GtkListView *list_view = NULL; + + for (GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (self->functions_column_view)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + { + if (GTK_IS_LIST_VIEW (child)) + { + list_view = GTK_LIST_VIEW (child); + break; + } + } + + gtk_selection_model_select_item (GTK_SELECTION_MODEL (functions), i, TRUE); + + if (list_view != NULL) + gtk_widget_activate_action (GTK_WIDGET (list_view), "list.scroll-to-item", "u", i); + + break; + } + } + } +} + static char * format_time_offset (gpointer cell) { @@ -371,6 +419,7 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass) 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, format_time_offset); + gtk_widget_class_bind_template_callback (widget_class, traceable_activate_cb); 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 eba0bb23..212aadd7 100644 --- a/src/libsysprof-gtk/sysprof-callgraph-view.ui +++ b/src/libsysprof-gtk/sysprof-callgraph-view.ui @@ -342,6 +342,8 @@ + + true Stack Trace