libsysprof-ui: hide unused sections

This commit is contained in:
Christian Hergert
2019-05-19 21:04:59 -07:00
parent aff39523ca
commit 8a394aaf0f
5 changed files with 22 additions and 7 deletions

View File

@ -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)
{

View File

@ -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")))

View File

@ -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)

View File

@ -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>

View File

@ -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">