mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-gtk: select function from traceable
This commit is contained in:
@ -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;
|
||||
|
||||
|
||||
@ -342,6 +342,8 @@
|
||||
<style>
|
||||
<class name="data-table"/>
|
||||
</style>
|
||||
<signal name="activate" handler="traceable_activate_cb" swapped="true"/>
|
||||
<property name="single-click-activate">true</property>
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="traceable_symbol_column">
|
||||
<property name="title" translatable="yes">Stack Trace</property>
|
||||
|
||||
Reference in New Issue
Block a user