mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-gtk: allow sorting descendants name column
This commit is contained in:
@ -37,6 +37,7 @@ struct _SysprofCallgraphView
|
||||
GtkColumnView *callers_column_view;
|
||||
GtkColumnView *descendants_column_view;
|
||||
GtkColumnView *functions_column_view;
|
||||
GtkCustomSorter *descendants_name_sorter;
|
||||
GtkCustomSorter *functions_name_sorter;
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
GtkWidget *paned;
|
||||
|
||||
@ -216,6 +216,7 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, callers_column_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, descendants_column_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, descendants_name_sorter);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, functions_column_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, functions_name_sorter);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, paned);
|
||||
@ -233,6 +234,18 @@ sysprof_callgraph_view_init (SysprofCallgraphView *self)
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static int
|
||||
descendants_name_compare (gconstpointer a,
|
||||
gconstpointer b,
|
||||
gpointer user_data)
|
||||
{
|
||||
SysprofCallgraphFrame *frame_a = (SysprofCallgraphFrame *)a;
|
||||
SysprofCallgraphFrame *frame_b = (SysprofCallgraphFrame *)b;
|
||||
|
||||
return g_strcmp0 (sysprof_symbol_get_name (sysprof_callgraph_frame_get_symbol (frame_a)),
|
||||
sysprof_symbol_get_name (sysprof_callgraph_frame_get_symbol (frame_b)));
|
||||
}
|
||||
|
||||
static int
|
||||
functions_name_compare (gconstpointer a,
|
||||
gconstpointer b,
|
||||
@ -315,6 +328,8 @@ sysprof_callgraph_view_reload_cb (GObject *object,
|
||||
gtk_column_view_set_model (self->functions_column_view,
|
||||
GTK_SELECTION_MODEL (functions_selection));
|
||||
|
||||
gtk_custom_sorter_set_sort_func (self->descendants_name_sorter,
|
||||
descendants_name_compare, NULL, NULL);
|
||||
gtk_custom_sorter_set_sort_func (self->functions_name_sorter,
|
||||
functions_name_compare, NULL, NULL);
|
||||
|
||||
|
||||
@ -109,6 +109,10 @@
|
||||
<object class="GtkColumnViewColumn" id="descendants_column">
|
||||
<property name="title" translatable="yes">Descendants</property>
|
||||
<property name="expand">true</property>
|
||||
<property name="sorter">
|
||||
<object class="GtkCustomSorter" id="descendants_name_sorter">
|
||||
</object>
|
||||
</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes"><![CDATA[
|
||||
|
||||
Reference in New Issue
Block a user