libsysprof-ui: use AdwPreferencesPage for memprof page

This commit is contained in:
Christian Hergert
2022-07-22 14:46:59 -07:00
parent 3e2a704231
commit cd4a22ed4b
2 changed files with 49 additions and 128 deletions

View File

@ -44,7 +44,6 @@
#include "../stackstash.h"
#include "egg-paned-private.h"
#include "egg-three-grid.h"
#include "sysprof-cell-renderer-percent.h"
#include "sysprof-memprof-page.h"
@ -68,7 +67,6 @@ typedef struct
GtkLabel *temp_allocs_count;
GtkLabel *num_allocs;
GtkLabel *leaked_allocs;
GtkLabel *peak_allocs;
GtkListBox *by_size;
GtkWidget *callgraph;
GtkWidget *summary_page;
@ -226,7 +224,14 @@ update_summary (SysprofMemprofPage *self,
title = gtk_label_new (NULL);
subtitle = gtk_label_new (NULL);
prog = gtk_level_bar_new_for_interval (0, stats.n_allocs);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
box = g_object_new (GTK_TYPE_BOX,
"orientation", GTK_ORIENTATION_VERTICAL,
"spacing", 6,
"margin-top", 6,
"margin-start", 6,
"margin-bottom", 6,
"margin-end", 6,
NULL);
sizestr = g_format_size_full (stats.by_size[i].bucket, G_FORMAT_SIZE_IEC_UNITS);
if (i == 0)
@ -1155,7 +1160,6 @@ sysprof_memprof_page_class_init (SysprofMemprofPageClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, num_allocs);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, leaked_allocs);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, leaked_allocs_button);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, peak_allocs);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, loading_state);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, empty_state);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, summary_page);
@ -1167,7 +1171,6 @@ sysprof_memprof_page_class_init (SysprofMemprofPageClass *klass)
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_Left, GDK_ALT_MASK, "go-previous", NULL);
g_type_ensure (EGG_TYPE_PANED);
g_type_ensure (EGG_TYPE_THREE_GRID);
g_type_ensure (SYSPROF_TYPE_CELL_RENDERER_PERCENT);
}

View File

@ -55,147 +55,65 @@
<child>
<object class="GtkStack" id="stack">
<child>
<object class="GtkScrolledWindow" id="summary_page">
<property name="hscrollbar-policy">never</property>
<object class="AdwPreferencesPage" id="summary_page">
<child>
<object class="GtkBox">
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="orientation">vertical</property>
<object class="AdwPreferencesGroup">
<child>
<object class="EggThreeGrid">
<property name="hexpand">true</property>
<property name="row-spacing">6</property>
<property name="column-spacing">18</property>
<child>
<object class="GtkLabel">
<property name="label">Peak Allocation</property>
<property name="halign">end</property>
<property name="visible">false</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">left</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="peak_allocs">
<property name="xalign">0</property>
<property name="selectable">true</property>
<property name="visible">false</property>
<layout>
<property name="column">center</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Number of Allocations</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">left</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="activatable">false</property>
<property name="title" translatable="yes">Number of Allocations</property>
<property name="subtitle" translatable="yes">Total number of allocation and free records</property>
<child type="suffix">
<object class="GtkLabel" id="num_allocs">
<property name="xalign">0</property>
<property name="hexpand">true</property>
<property name="xalign">1</property>
<property name="selectable">true</property>
<layout>
<property name="column">center</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Leaked Allocations</property>
<property name="halign">end</property>
<property name="visible">false</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">left</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="activatable">false</property>
<property name="title" translatable="yes">Leaked Allocations</property>
<property name="subtitle" translatable="yes">Number of allocations without a free record</property>
<child type="suffix">
<object class="GtkLabel" id="leaked_allocs">
<property name="xalign">0</property>
<property name="hexpand">true</property>
<property name="xalign">1</property>
<property name="selectable">true</property>
<property name="visible">false</property>
<layout>
<property name="column">center</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Temporary Allocations</property>
<property name="halign">end</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">left</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="activatable">false</property>
<property name="title" translatable="yes">Temporary Allocations</property>
<property name="subtitle" translatable="yes">Number of allocations freed from similar stack trace</property>
<child type="suffix">
<object class="GtkLabel" id="temp_allocs_count">
<property name="xalign">0</property>
<property name="hexpand">true</property>
<property name="xalign">1</property>
<property name="selectable">true</property>
<property name="width-chars">50</property>
<layout>
<property name="column">center</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Allocations by Size</property>
<property name="halign">end</property>
<property name="valign">start</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">left</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkFrame">
<child>
<object class="GtkListBox" id="by_size">
</object>
</child>
<layout>
<property name="column">center</property>
<property name="row">4</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Allocations by Size</property>
<child>
<object class="GtkListBox" id="by_size">
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>