[sysprof/wip/gtk4-port] memprofpage: use Adwaita and cleanup usage
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/gtk4-port] memprofpage: use Adwaita and cleanup usage
- Date: Fri, 1 Oct 2021 20:38:09 +0000 (UTC)
commit 615b5d8375017ecf4c584f8d81aa5cb54945d816
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 1 13:37:29 2021 -0700
memprofpage: use Adwaita and cleanup usage
src/libsysprof-ui/sysprof-memprof-page.c | 24 ++++---
src/libsysprof-ui/sysprof-memprof-page.ui | 109 +++++++++++++-----------------
2 files changed, 64 insertions(+), 69 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-memprof-page.c b/src/libsysprof-ui/sysprof-memprof-page.c
index 851e68bd..3d96fae9 100644
--- a/src/libsysprof-ui/sysprof-memprof-page.c
+++ b/src/libsysprof-ui/sysprof-memprof-page.c
@@ -66,6 +66,10 @@ typedef struct
GtkLabel *leaked_allocs;
GtkLabel *peak_allocs;
GtkListBox *by_size;
+ GtkWidget *callgraph;
+ GtkWidget *summary_page;
+ GtkWidget *loading_state;
+ GtkWidget *empty_state;
GCancellable *cancellable;
@@ -306,7 +310,7 @@ sysprof_memprof_page_load (SysprofMemprofPage *self,
if (sysprof_memprof_profile_is_empty (profile))
{
- gtk_stack_set_visible_child_name (priv->stack, "summary");
+ gtk_stack_set_visible_child (priv->stack, priv->summary_page);
return;
}
@@ -341,7 +345,7 @@ sysprof_memprof_page_load (SysprofMemprofPage *self,
gtk_tree_selection_select_iter (selection, &iter);
}
- gtk_stack_set_visible_child_name (priv->stack, "callgraph");
+ gtk_stack_set_visible_child (priv->stack, priv->callgraph);
g_clear_object (&functions);
}
@@ -353,7 +357,7 @@ _sysprof_memprof_page_set_failed (SysprofMemprofPage *self)
g_return_if_fail (SYSPROF_IS_MEMPROF_PAGE (self));
- gtk_stack_set_visible_child_name (priv->stack, "empty-state");
+ gtk_stack_set_visible_child (priv->stack, priv->empty_state);
}
static void
@@ -372,7 +376,7 @@ sysprof_memprof_page_unload (SysprofMemprofPage *self)
gtk_tree_view_set_model (priv->functions_view, NULL);
gtk_tree_view_set_model (priv->descendants_view, NULL);
- gtk_stack_set_visible_child_name (priv->stack, "empty-state");
+ gtk_stack_set_visible_child (priv->stack, priv->empty_state);
}
/**
@@ -970,7 +974,7 @@ sysprof_memprof_page_load_async (SysprofPage *page,
else
g_set_object (&priv->cancellable, cancellable);
- gtk_stack_set_visible_child_name (priv->stack, "loading");
+ gtk_stack_set_visible_child (priv->stack, priv->loading_state);
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, sysprof_memprof_page_load_async);
@@ -1145,6 +1149,10 @@ 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, 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);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, callgraph);
gtk_widget_class_install_action (widget_class, "page.copy", NULL, sysprof_memprof_page_copy_cb);
@@ -1166,7 +1174,7 @@ sysprof_memprof_page_init (SysprofMemprofPage *self)
gtk_widget_init_template (GTK_WIDGET (self));
- gtk_stack_set_visible_child_name (priv->stack, "empty-state");
+ gtk_stack_set_visible_child (priv->stack, priv->empty_state);
gtk_list_box_set_header_func (priv->by_size, sep_header_func, NULL, NULL);
@@ -1521,7 +1529,7 @@ _sysprof_memprof_page_set_loading (SysprofMemprofPage *self,
priv->loading--;
if (priv->loading)
- gtk_stack_set_visible_child_name (priv->stack, "loading");
+ gtk_stack_set_visible_child (priv->stack, priv->loading_state);
else
- gtk_stack_set_visible_child_name (priv->stack, "callgraph");
+ gtk_stack_set_visible_child (priv->stack, priv->callgraph);
}
diff --git a/src/libsysprof-ui/sysprof-memprof-page.ui b/src/libsysprof-ui/sysprof-memprof-page.ui
index 374ea0eb..dd0c29e8 100644
--- a/src/libsysprof-ui/sysprof-memprof-page.ui
+++ b/src/libsysprof-ui/sysprof-memprof-page.ui
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="SysprofMemprofPage" parent="SysprofPage">
<child>
@@ -58,7 +59,7 @@
<object class="GtkStack" id="stack">
<property name="visible">true</property>
<child>
- <object class="GtkScrolledWindow">
+ <object class="GtkScrolledWindow" id="summary_page">
<property name="hscrollbar-policy">never</property>
<property name="visible">true</property>
<child>
@@ -70,7 +71,7 @@
<property name="orientation">vertical</property>
<property name="visible">true</property>
<child>
- <object class="DzlThreeGrid">
+ <object class="EggThreeGrid">
<property name="expand">true</property>
<property name="row-spacing">6</property>
<property name="column-spacing">18</property>
@@ -83,22 +84,22 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">left</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="column">left</property>
- <property name="row">0</property>
- </packing>
</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>
- <packing>
- <property name="column">center</property>
- <property name="row">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -108,22 +109,22 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">left</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="column">left</property>
- <property name="row">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="num_allocs">
<property name="xalign">0</property>
<property name="selectable">true</property>
<property name="visible">true</property>
+ <layout>
+ <property name="column">center</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="column">center</property>
- <property name="row">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -133,22 +134,22 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">left</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="column">left</property>
- <property name="row">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="leaked_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">2</property>
+ </layout>
</object>
- <packing>
- <property name="column">center</property>
- <property name="row">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -158,11 +159,11 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">left</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="column">left</property>
- <property name="row">3</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="temp_allocs_count">
@@ -170,11 +171,11 @@
<property name="selectable">true</property>
<property name="width-chars">50</property>
<property name="visible">true</property>
+ <layout>
+ <property name="column">center</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="column">center</property>
- <property name="row">3</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -185,11 +186,11 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="column">left</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="column">left</property>
- <property name="row">4</property>
- </packing>
</child>
<child>
<object class="GtkFrame">
@@ -199,23 +200,20 @@
<property name="visible">true</property>
</object>
</child>
+ <layout>
+ <property name="column">center</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="column">center</property>
- <property name="row">4</property>
- </packing>
</child>
</object>
</child>
</object>
</child>
</object>
- <packing>
- <property name="name">summary</property>
- </packing>
</child>
<child>
- <object class="GtkPaned">
+ <object class="GtkPaned" id="callgraph">
<property name="orientation">horizontal</property>
<property name="position">450</property>
<property name="expand">true</property>
@@ -415,31 +413,20 @@
</object>
</child>
</object>
- <packing>
- <property name="name">callgraph</property>
- </packing>
</child>
<child>
- <object class="DzlEmptyState">
+ <object class="AdwStatusPage" id="loading_state">
<property name="icon-name">content-loading-symbolic</property>
<property name="title" translatable="yes">Analyzing Memory Allocations</property>
- <property name="subtitle" translatable="yes">Sysprof is busy analyzing memory
allocations.</property>
- <property name="visible">true</property>
+ <property name="description" translatable="yes">Sysprof is busy analyzing memory
allocations.</property>
</object>
- <packing>
- <property name="name">loading</property>
- </packing>
</child>
<child>
- <object class="DzlEmptyState">
+ <object class="AdwStatusPage" id="empty_state">
<property name="icon-name">computer-fail-symbolic</property>
<property name="title" translatable="yes">Not Enough Samples</property>
- <property name="subtitle" translatable="yes">More samples are necessary to display a
callgraph.</property>
- <property name="visible">false</property>
+ <property name="description" translatable="yes">More samples are necessary to display a
callgraph.</property>
</object>
- <packing>
- <property name="name">empty-state</property>
- </packing>
</child>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]