mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-gtk: add stub for caller selection changed
This commit is contained in:
@ -38,6 +38,27 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (SysprofCallgraphView, sysprof_callgraph_view,
|
|||||||
|
|
||||||
static GParamSpec *properties [N_PROPS];
|
static GParamSpec *properties [N_PROPS];
|
||||||
|
|
||||||
|
static void
|
||||||
|
callers_selection_changed_cb (SysprofCallgraphView *self,
|
||||||
|
guint position,
|
||||||
|
guint n_items,
|
||||||
|
GtkSingleSelection *single)
|
||||||
|
{
|
||||||
|
GObject *object;
|
||||||
|
|
||||||
|
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
|
||||||
|
g_assert (GTK_IS_SINGLE_SELECTION (single));
|
||||||
|
|
||||||
|
if ((object = gtk_single_selection_get_selected_item (single)))
|
||||||
|
{
|
||||||
|
SysprofCallgraphSymbol *sym = SYSPROF_CALLGRAPH_SYMBOL (object);
|
||||||
|
SysprofSymbol *symbol = sysprof_callgraph_symbol_get_symbol (sym);
|
||||||
|
|
||||||
|
g_print ("Caller %s selected.\n",
|
||||||
|
sysprof_symbol_get_name (symbol));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
functions_selection_changed_cb (SysprofCallgraphView *self,
|
functions_selection_changed_cb (SysprofCallgraphView *self,
|
||||||
guint position,
|
guint position,
|
||||||
@ -54,14 +75,19 @@ functions_selection_changed_cb (SysprofCallgraphView *self,
|
|||||||
SysprofCallgraphSymbol *sym = SYSPROF_CALLGRAPH_SYMBOL (object);
|
SysprofCallgraphSymbol *sym = SYSPROF_CALLGRAPH_SYMBOL (object);
|
||||||
SysprofSymbol *symbol = sysprof_callgraph_symbol_get_symbol (sym);
|
SysprofSymbol *symbol = sysprof_callgraph_symbol_get_symbol (sym);
|
||||||
g_autoptr(GtkSortListModel) callers_sort_model = NULL;
|
g_autoptr(GtkSortListModel) callers_sort_model = NULL;
|
||||||
g_autoptr(GtkNoSelection) callers_selection = NULL;
|
g_autoptr(GtkSingleSelection) callers_selection = NULL;
|
||||||
g_autoptr(GListModel) callers = sysprof_callgraph_list_callers (self->callgraph, symbol);
|
g_autoptr(GListModel) callers = sysprof_callgraph_list_callers (self->callgraph, symbol);
|
||||||
GtkSorter *column_sorter;
|
GtkSorter *column_sorter;
|
||||||
|
|
||||||
column_sorter = gtk_column_view_get_sorter (self->callers_column_view);
|
column_sorter = gtk_column_view_get_sorter (self->callers_column_view);
|
||||||
callers_sort_model = gtk_sort_list_model_new (g_object_ref (callers),
|
callers_sort_model = gtk_sort_list_model_new (g_object_ref (callers),
|
||||||
g_object_ref (column_sorter));
|
g_object_ref (column_sorter));
|
||||||
callers_selection = gtk_no_selection_new (g_object_ref (G_LIST_MODEL (callers_sort_model)));
|
callers_selection = gtk_single_selection_new (g_object_ref (G_LIST_MODEL (callers_sort_model)));
|
||||||
|
g_signal_connect_object (callers_selection,
|
||||||
|
"selection-changed",
|
||||||
|
G_CALLBACK (callers_selection_changed_cb),
|
||||||
|
self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
gtk_column_view_set_model (self->callers_column_view,
|
gtk_column_view_set_model (self->callers_column_view,
|
||||||
GTK_SELECTION_MODEL (callers_selection));
|
GTK_SELECTION_MODEL (callers_selection));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user