[sysprof/wip/gtk4-port: 93/125] callgraphpage: use libadwaita and fix some properties




commit 46842fef798dcbd61a066576913c6f1dd650ddae
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 1 13:23:00 2021 -0700

    callgraphpage: use libadwaita and fix some properties

 src/libsysprof-ui/sysprof-callgraph-page.c  | 18 ++++++++++++------
 src/libsysprof-ui/sysprof-callgraph-page.ui | 26 ++++++--------------------
 2 files changed, 18 insertions(+), 26 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-callgraph-page.c b/src/libsysprof-ui/sysprof-callgraph-page.c
index d956423f..47afe1ac 100644
--- a/src/libsysprof-ui/sysprof-callgraph-page.c
+++ b/src/libsysprof-ui/sysprof-callgraph-page.c
@@ -55,6 +55,9 @@ typedef struct
   GtkTreeView              *descendants_view;
   GtkTreeViewColumn        *descendants_name_column;
   GtkStack                 *stack;
+  GtkWidget                *empty_state;
+  GtkWidget                *loading_state;
+  GtkWidget                *callgraph;
 
   GQueue                   *history;
 
@@ -207,7 +210,7 @@ sysprof_callgraph_page_load (SysprofCallgraphPage    *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);
 }
@@ -219,7 +222,7 @@ _sysprof_callgraph_page_set_failed (SysprofCallgraphPage *self)
 
   g_return_if_fail (SYSPROF_IS_CALLGRAPH_PAGE (self));
 
-  gtk_stack_set_visible_child_name (priv->stack, "empty-state");
+  gtk_stack_set_visible_child (priv->stack, priv->empty_state);
 }
 
 static void
@@ -238,7 +241,7 @@ sysprof_callgraph_page_unload (SysprofCallgraphPage *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);
 }
 
 /**
@@ -926,6 +929,9 @@ sysprof_callgraph_page_class_init (SysprofCallgraphPageClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphPage, descendants_view);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphPage, descendants_name_column);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphPage, stack);
+  gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphPage, callgraph);
+  gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphPage, empty_state);
+  gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphPage, loading_state);
 
   gtk_widget_class_install_action (widget_class, "page.copy", NULL, sysprof_callgraph_page_copy_cb);
 
@@ -946,7 +952,7 @@ sysprof_callgraph_page_init (SysprofCallgraphPage *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);
 
   selection = gtk_tree_view_get_selection (priv->functions_view);
 
@@ -1278,7 +1284,7 @@ _sysprof_callgraph_page_set_loading (SysprofCallgraphPage *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-callgraph-page.ui b/src/libsysprof-ui/sysprof-callgraph-page.ui
index 2642e01b..875b9e12 100644
--- a/src/libsysprof-ui/sysprof-callgraph-page.ui
+++ b/src/libsysprof-ui/sysprof-callgraph-page.ui
@@ -4,10 +4,12 @@
       <object class="GtkStack" id="stack">
         <property name="visible">true</property>
         <child>
-          <object class="GtkPaned">
+          <object class="GtkPaned" id="callgraph">
             <property name="orientation">horizontal</property>
             <property name="position">450</property>
             <property name="visible">true</property>
+            <property name="resize-start-child">true</property>
+            <property name="resize-end-child">true</property>
             <child>
               <object class="GtkPaned">
                 <property name="orientation">vertical</property>
@@ -70,9 +72,6 @@
                       </object>
                     </child>
                   </object>
-                  <packing>
-                    <property name="resize">true</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkScrolledWindow">
@@ -131,9 +130,6 @@
                       </object>
                     </child>
                   </object>
-                  <packing>
-                    <property name="resize">true</property>
-                  </packing>
                 </child>
               </object>
             </child>
@@ -203,31 +199,21 @@
               </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">Generating Callgraph</property>
-            <property name="subtitle" translatable="yes">Sysprof is busy creating the selected 
callgraph.</property>
-            <property name="visible">true</property>
+            <property name="description" translatable="yes">Sysprof is busy creating the selected 
callgraph.</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>
           </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]