[sysprof] libsysprof-ui: jump to timings if no samples
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof-ui: jump to timings if no samples
- Date: Wed, 29 May 2019 22:29:25 +0000 (UTC)
commit 09a29dfb80ed4fa91946167bad2b004a7b1b5277
Author: Christian Hergert <chergert redhat com>
Date: Wed May 15 17:08:13 2019 -0700
libsysprof-ui: jump to timings if no samples
src/libsysprof-ui/sysprof-capture-view.c | 23 ++++++++++++++++-------
src/libsysprof-ui/ui/sysprof-capture-view.ui | 7 +++++--
2 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c
index 794091c..023fab0 100644
--- a/src/libsysprof-ui/sysprof-capture-view.c
+++ b/src/libsysprof-ui/sysprof-capture-view.c
@@ -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);
diff --git a/src/libsysprof-ui/ui/sysprof-capture-view.ui b/src/libsysprof-ui/ui/sysprof-capture-view.ui
index 86413bf..2e1e54d 100644
--- a/src/libsysprof-ui/ui/sysprof-capture-view.ui
+++ b/src/libsysprof-ui/ui/sysprof-capture-view.ui
@@ -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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]