libsysprof-ui: jump to timings if no samples

This commit is contained in:
Christian Hergert
2019-05-15 17:08:13 -07:00
parent 59d40f4146
commit 09a29dfb80
2 changed files with 21 additions and 9 deletions

View File

@ -45,6 +45,7 @@ typedef struct
SysprofCaptureFeatures features;
/* Template Objects */
GtkStack *stack;
SysprofCallgraphView *callgraph_view;
SysprofDetailsView *details_view;
SysprofMarksView *marks_view;
@ -150,6 +151,8 @@ sysprof_capture_view_generate_callgraph_cb (GObject *object,
SysprofCallgraphProfile *callgraph = (SysprofCallgraphProfile *)object;
g_autoptr(GError) error = NULL;
g_autoptr(GTask) task = user_data;
SysprofCaptureView *self;
SysprofCaptureViewPrivate *priv;
g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (callgraph));
g_assert (G_IS_ASYNC_RESULT (result));
@ -158,15 +161,15 @@ sysprof_capture_view_generate_callgraph_cb (GObject *object,
if (!sysprof_profile_generate_finish (SYSPROF_PROFILE (callgraph), result, &error))
{
g_task_return_error (task, g_steal_pointer (&error));
return;
}
else
{
SysprofCaptureView *self = g_task_get_source_object (task);
SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
sysprof_callgraph_view_set_profile (priv->callgraph_view, callgraph);
g_task_return_boolean (task, TRUE);
}
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);
}
static void
@ -307,9 +310,14 @@ sysprof_capture_view_scan_finish (SysprofCaptureView *self,
GAsyncResult *result,
GError **error)
{
SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (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");
return g_task_propagate_boolean (G_TASK (result), error);
}
@ -612,6 +620,7 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, callgraph_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, details_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, marks_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack_switcher);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, visualizer_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, zoom_manager);

View File

@ -70,7 +70,7 @@
</child>
<child type="center">
<object class="GtkStackSwitcher" id="stack_switcher">
<property name="stack">sections_stack</property>
<property name="stack">stack</property>
<property name="halign">center</property>
<property name="visible">true</property>
<property name="margin-top">6</property>
@ -105,7 +105,7 @@
</object>
</child>
<child>
<object class="GtkStack" id="sections_stack">
<object class="GtkStack" id="stack">
<property name="homogeneous">true</property>
<property name="visible">true</property>
<property name="vexpand">true</property>
@ -116,6 +116,7 @@
<packing>
<!-- translators: the _ is used to denote the accelerator key -->
<property name="title" translatable="yes">_Callgraph</property>
<property name="name">callgraph</property>
</packing>
</child>
<child>
@ -126,6 +127,7 @@
<packing>
<!-- translators: the _ is used to denote the accelerator key -->
<property name="title" translatable="yes">_Timings</property>
<property name="name">timings</property>
</packing>
</child>
<child>
@ -136,6 +138,7 @@
<packing>
<!-- translators: the _ is used to denote the accelerator key -->
<property name="title" translatable="yes">_Details</property>
<property name="name">details</property>
</packing>
</child>
</object>