[sysprof/wip/chergert/sysprof-3] libsysprof-ui: hide unused sections



commit ead875a2305d5586ae95022c1f94700a4aa0f825
Author: Christian Hergert <chergert redhat com>
Date:   Sun May 19 21:04:59 2019 -0700

    libsysprof-ui: hide unused sections

 src/libsysprof-ui/sysprof-callgraph-view.c     | 10 ++++++++++
 src/libsysprof-ui/sysprof-capture-view.c       | 14 +++++++++-----
 src/libsysprof-ui/sysprof-ui-private.h         |  2 ++
 src/libsysprof-ui/ui/sysprof-callgraph-view.ui |  2 +-
 src/libsysprof-ui/ui/sysprof-display.ui        |  1 -
 5 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-callgraph-view.c b/src/libsysprof-ui/sysprof-callgraph-view.c
index cc0bb4c..603450e 100644
--- a/src/libsysprof-ui/sysprof-callgraph-view.c
+++ b/src/libsysprof-ui/sysprof-callgraph-view.c
@@ -211,6 +211,16 @@ sysprof_callgraph_view_load (SysprofCallgraphView    *self,
   g_clear_object (&functions);
 }
 
+void
+_sysprof_callgraph_view_set_failed (SysprofCallgraphView *self)
+{
+  SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
+
+  g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
+
+  gtk_stack_set_visible_child_name (priv->stack, "empty-state");
+}
+
 static void
 sysprof_callgraph_view_unload (SysprofCallgraphView *self)
 {
diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c
index 9fcce3e..4fd67a6 100644
--- a/src/libsysprof-ui/sysprof-capture-view.c
+++ b/src/libsysprof-ui/sysprof-capture-view.c
@@ -292,15 +292,16 @@ sysprof_capture_view_generate_callgraph_cb (GObject      *object,
   g_assert (G_IS_ASYNC_RESULT (result));
   g_assert (G_IS_TASK (task));
 
+  self = g_task_get_source_object (task);
+  priv = sysprof_capture_view_get_instance_private (self);
+
   if (!sysprof_profile_generate_finish (SYSPROF_PROFILE (callgraph), result, &error))
     {
+      _sysprof_callgraph_view_set_failed (priv->callgraph_view);
       g_task_return_error (task, g_steal_pointer (&error));
       return;
     }
 
-  self = g_task_get_source_object (task);
-  priv = sysprof_capture_view_get_instance_private (self);
-
   sysprof_callgraph_view_set_profile (priv->callgraph_view, callgraph);
 
   g_task_return_boolean (task, TRUE);
@@ -513,8 +514,11 @@ sysprof_capture_view_scan_finish (SysprofCaptureView  *self,
   g_assert (SYSPROF_IS_CAPTURE_VIEW (self));
   g_assert (G_IS_TASK (result));
 
-  if (!priv->features.has_samples && priv->features.has_marks)
-    gtk_stack_set_visible_child_name (priv->stack, "timings");
+  if (!priv->features.has_samples)
+    gtk_widget_hide (GTK_WIDGET (priv->callgraph_view));
+
+  if (!priv->features.has_marks)
+    gtk_widget_hide (GTK_WIDGET (priv->marks_view));
 
   g_clear_pointer (&priv->mark_stats, g_hash_table_unref);
   if ((stats = g_object_get_data (G_OBJECT (result), "MARK_STAT")))
diff --git a/src/libsysprof-ui/sysprof-ui-private.h b/src/libsysprof-ui/sysprof-ui-private.h
index 31e6fc3..26e2353 100644
--- a/src/libsysprof-ui/sysprof-ui-private.h
+++ b/src/libsysprof-ui/sysprof-ui-private.h
@@ -20,6 +20,7 @@
 
 #pragma once
 
+#include "sysprof-callgraph-view.h"
 #include "sysprof-marks-view.h"
 #include "sysprof-visualizer-view.h"
 
@@ -46,6 +47,7 @@ void             _sysprof_rounded_rectangle               (cairo_t
                                                            gint                   x_radius,
                                                            gint                   y_radius);
 gchar           *_sysprof_format_duration                 (gint64                 duration);
+void             _sysprof_callgraph_view_set_failed       (SysprofCallgraphView  *self);
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofMarkStat, _sysprof_mark_stat_free)
 
diff --git a/src/libsysprof-ui/ui/sysprof-callgraph-view.ui b/src/libsysprof-ui/ui/sysprof-callgraph-view.ui
index d32d4b6..f3164f7 100644
--- a/src/libsysprof-ui/ui/sysprof-callgraph-view.ui
+++ b/src/libsysprof-ui/ui/sysprof-callgraph-view.ui
@@ -197,7 +197,7 @@
             <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">true</property>
+            <property name="visible">false</property>
           </object>
           <packing>
             <property name="name">empty-state</property>
diff --git a/src/libsysprof-ui/ui/sysprof-display.ui b/src/libsysprof-ui/ui/sysprof-display.ui
index cbda121..a9af096 100644
--- a/src/libsysprof-ui/ui/sysprof-display.ui
+++ b/src/libsysprof-ui/ui/sysprof-display.ui
@@ -4,7 +4,6 @@
     <child>
       <object class="GtkStack" id="stack">
         <property name="homogeneous">false</property>
-        <property name="transition-type">crossfade</property>
         <property name="visible">true</property>
         <child>
           <object class="SysprofProfilerAssistant" id="assistant">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]