mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
sysprof: allow filtering functions
This commit is contained in:
@ -46,6 +46,7 @@ struct _SysprofCallgraphView
|
||||
GtkCustomSorter *functions_name_sorter;
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
GtkWidget *paned;
|
||||
GtkStringFilter *function_filter;
|
||||
|
||||
GCancellable *cancellable;
|
||||
|
||||
|
||||
@ -514,6 +514,7 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
|
||||
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, function_filter);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofCallgraphView, paned);
|
||||
|
||||
gtk_widget_class_install_action (widget_class, "callgraph.make-descendant-root", NULL, make_descendant_root_action);
|
||||
@ -523,6 +524,7 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
|
||||
g_resources_register (sysprof_get_resource ());
|
||||
|
||||
g_type_ensure (PANEL_TYPE_PANED);
|
||||
g_type_ensure (SYSPROF_TYPE_CALLGRAPH_SYMBOL);
|
||||
g_type_ensure (SYSPROF_TYPE_CATEGORY_ICON);
|
||||
g_type_ensure (SYSPROF_TYPE_SYMBOL_LABEL);
|
||||
g_type_ensure (SYSPROF_TYPE_TREE_EXPANDER);
|
||||
@ -589,6 +591,7 @@ sysprof_callgraph_view_reload_cb (GObject *object,
|
||||
{
|
||||
SysprofDocument *document = (SysprofDocument *)object;
|
||||
g_autoptr(SysprofCallgraphView) self = user_data;
|
||||
g_autoptr(GtkFilterListModel) filter_model = NULL;
|
||||
g_autoptr(SysprofCallgraph) callgraph = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
GtkSorter *column_sorter;
|
||||
@ -613,7 +616,10 @@ sysprof_callgraph_view_reload_cb (GObject *object,
|
||||
|
||||
column_sorter = gtk_column_view_get_sorter (self->functions_column_view);
|
||||
functions_model = sysprof_callgraph_list_symbols (callgraph);
|
||||
functions_sort_model = gtk_sort_list_model_new (g_object_ref (functions_model),
|
||||
filter_model = gtk_filter_list_model_new (g_object_ref (G_LIST_MODEL (functions_model)),
|
||||
g_object_ref (GTK_FILTER (self->function_filter)));
|
||||
gtk_filter_list_model_set_incremental (filter_model, TRUE);
|
||||
functions_sort_model = gtk_sort_list_model_new (g_object_ref (G_LIST_MODEL (filter_model)),
|
||||
g_object_ref (column_sorter));
|
||||
functions_selection = gtk_single_selection_new (g_object_ref (G_LIST_MODEL (functions_sort_model)));
|
||||
gtk_single_selection_set_autoselect (functions_selection, FALSE);
|
||||
|
||||
@ -7,23 +7,26 @@
|
||||
<object class="PanelPaned">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="functions_scrolled_window">
|
||||
<property name="vexpand">true</property>
|
||||
<property name="propagate-natural-width">true</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkColumnView" id="functions_column_view">
|
||||
<object class="GtkScrolledWindow" id="functions_scrolled_window">
|
||||
<property name="vexpand">true</property>
|
||||
<property name="propagate-natural-width">true</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="functions_name_column">
|
||||
<property name="title" translatable="yes">Functions</property>
|
||||
<property name="expand">true</property>
|
||||
<property name="sorter">
|
||||
<object class="GtkCustomSorter" id="functions_name_sorter">
|
||||
</object>
|
||||
</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes"><![CDATA[
|
||||
<object class="GtkColumnView" id="functions_column_view">
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="functions_name_column">
|
||||
<property name="title" translatable="yes">Functions</property>
|
||||
<property name="expand">true</property>
|
||||
<property name="sorter">
|
||||
<object class="GtkCustomSorter" id="functions_name_sorter">
|
||||
</object>
|
||||
</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes"><![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="GtkListItem">
|
||||
@ -50,9 +53,26 @@
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]></property>
|
||||
]]>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="filter_search_entry">
|
||||
<property name="placeholder-text" translatable="yes">Filter Functions</property>
|
||||
<property name="margin-top">3</property>
|
||||
<property name="margin-bottom">3</property>
|
||||
<property name="margin-start">3</property>
|
||||
<property name="margin-end">3</property>
|
||||
<property name="hexpand">true</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -265,4 +285,15 @@
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
<object class="GtkStringFilter" id="function_filter">
|
||||
<property name="match-mode">substring</property>
|
||||
<property name="expression">
|
||||
<lookup name="name" type="SysprofSymbol">
|
||||
<lookup name="symbol" type="SysprofCallgraphSymbol"/>
|
||||
</lookup>
|
||||
</property>
|
||||
<binding name="search">
|
||||
<lookup name="text">filter_search_entry</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
Reference in New Issue
Block a user