[sysprof/wip/chergert/sysprof-3] libsysprof-ui: add empty state for timing data
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/sysprof-3] libsysprof-ui: add empty state for timing data
- Date: Thu, 16 May 2019 02:35:07 +0000 (UTC)
commit 966c5b5bd4d21a08d418a7055a93ae0ad737fbc6
Author: Christian Hergert <chergert redhat com>
Date: Wed May 15 19:34:54 2019 -0700
libsysprof-ui: add empty state for timing data
src/libsysprof-ui/sysprof-capture-view.c | 17 ++--
src/libsysprof-ui/sysprof-marks-view.c | 7 ++
src/libsysprof-ui/ui/sysprof-marks-view.ui | 133 ++++++++++++++++-------------
3 files changed, 90 insertions(+), 67 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c
index 9bc4097..39a447a 100644
--- a/src/libsysprof-ui/sysprof-capture-view.c
+++ b/src/libsysprof-ui/sysprof-capture-view.c
@@ -434,16 +434,13 @@ sysprof_capture_view_load_scan_cb (GObject *object,
if (priv->features.has_counters || priv->features.has_marks)
sysprof_visualizer_view_set_reader (priv->visualizer_view, state->reader);
- if (priv->features.has_marks)
- {
- state->n_active++;
- sysprof_marks_view_load_async (priv->marks_view,
- state->reader,
- state->selection,
- g_task_get_cancellable (task),
- sysprof_capture_view_load_marks_cb,
- g_object_ref (task));
- }
+ state->n_active++;
+ sysprof_marks_view_load_async (priv->marks_view,
+ state->reader,
+ state->selection,
+ g_task_get_cancellable (task),
+ sysprof_capture_view_load_marks_cb,
+ g_object_ref (task));
sysprof_details_view_set_reader (priv->details_view, priv->reader);
diff --git a/src/libsysprof-ui/sysprof-marks-view.c b/src/libsysprof-ui/sysprof-marks-view.c
index 1e720d1..0175d9d 100644
--- a/src/libsysprof-ui/sysprof-marks-view.c
+++ b/src/libsysprof-ui/sysprof-marks-view.c
@@ -39,6 +39,7 @@ typedef struct
GtkTreeView *tree_view;
GtkTreeViewColumn *duration_column;
SysprofCellRendererDuration *duration_cell;
+ GtkStack *stack;
} SysprofMarksViewPrivate;
enum {
@@ -216,6 +217,7 @@ sysprof_marks_view_class_init (SysprofMarksViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, tree_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, duration_cell);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, duration_column);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, stack);
properties [PROP_ZOOM_MANAGER] =
g_param_spec_object ("zoom-manager", NULL, NULL,
@@ -291,6 +293,11 @@ sysprof_marks_view_load_cb (GObject *object,
gtk_tree_view_set_model (priv->tree_view, GTK_TREE_MODEL (model));
+ if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 0)
+ gtk_stack_set_visible_child_name (priv->stack, "empty-state");
+ else
+ gtk_stack_set_visible_child_name (priv->stack, "marks");
+
g_task_return_boolean (task, TRUE);
}
diff --git a/src/libsysprof-ui/ui/sysprof-marks-view.ui b/src/libsysprof-ui/ui/sysprof-marks-view.ui
index 3a15685..06fafcb 100644
--- a/src/libsysprof-ui/ui/sysprof-marks-view.ui
+++ b/src/libsysprof-ui/ui/sysprof-marks-view.ui
@@ -2,82 +2,101 @@
<interface>
<template class="SysprofMarksView" parent="GtkBin">
<child>
- <object class="GtkScrolledWindow" id="scroller">
+ <object class="GtkStack" id="stack">
<property name="visible">true</property>
<child>
- <object class="GtkTreeView" id="tree_view">
- <property name="headers-visible">false</property>
- <property name="enable-grid-lines">horizontal</property>
+ <object class="GtkScrolledWindow" id="scroller">
<property name="visible">true</property>
<child>
- <object class="GtkTreeViewColumn">
- <property name="title" translatable="yes">Group</property>
- <property name="resizable">true</property>
- <property name="expand">false</property>
- <property name="visible">false</property>
+ <object class="GtkTreeView" id="tree_view">
+ <property name="headers-visible">false</property>
+ <property name="enable-grid-lines">horizontal</property>
+ <property name="visible">true</property>
<child>
- <object class="GtkCellRendererText" id="text_cell">
- <property name="xalign">0</property>
+ <object class="GtkTreeViewColumn">
+ <property name="title" translatable="yes">Group</property>
+ <property name="resizable">true</property>
+ <property name="expand">false</property>
+ <property name="visible">false</property>
+ <child>
+ <object class="GtkCellRendererText" id="text_cell">
+ <property name="xalign">0</property>
+ </object>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn">
- <property name="title" translatable="yes">Name</property>
- <property name="resizable">true</property>
- <property name="expand">false</property>
- <property name="visible">false</property>
<child>
- <object class="GtkCellRendererText">
- <property name="xalign">0</property>
+ <object class="GtkTreeViewColumn">
+ <property name="title" translatable="yes">Name</property>
+ <property name="resizable">true</property>
+ <property name="expand">false</property>
+ <property name="visible">false</property>
+ <child>
+ <object class="GtkCellRendererText">
+ <property name="xalign">0</property>
+ </object>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="elapsed_column">
- <property name="title" translatable="yes">Elapsed</property>
- <property name="resizable">true</property>
- <property name="expand">false</property>
- <property name="visible">false</property>
<child>
- <object class="GtkCellRendererText">
- <property name="xalign">0</property>
+ <object class="GtkTreeViewColumn" id="elapsed_column">
+ <property name="title" translatable="yes">Elapsed</property>
+ <property name="resizable">true</property>
+ <property name="expand">false</property>
+ <property name="visible">false</property>
+ <child>
+ <object class="GtkCellRendererText">
+ <property name="xalign">0</property>
+ </object>
+ <attributes>
+ <attribute name="text">4</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="text">4</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="duration_column">
- <property name="title" translatable="yes">Duration</property>
- <property name="expand">true</property>
<child>
- <object class="SysprofCellRendererDuration" id="duration_cell">
- <property name="xalign">0</property>
- <property name="ypad">1</property>
- </object>
- <attributes>
- <attribute name="text">1</attribute>
- <attribute name="begin-time">2</attribute>
- <attribute name="end-time">3</attribute>
- </attributes>
- <cell-packing>
+ <object class="GtkTreeViewColumn" id="duration_column">
+ <property name="title" translatable="yes">Duration</property>
<property name="expand">true</property>
- </cell-packing>
+ <child>
+ <object class="SysprofCellRendererDuration" id="duration_cell">
+ <property name="xalign">0</property>
+ <property name="ypad">1</property>
+ </object>
+ <attributes>
+ <attribute name="text">1</attribute>
+ <attribute name="begin-time">2</attribute>
+ <attribute name="end-time">3</attribute>
+ </attributes>
+ <cell-packing>
+ <property name="expand">true</property>
+ </cell-packing>
+ </child>
+ </object>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="name">marks</property>
+ </packing>
+ </child>
+ <child>
+ <object class="SysprofEmptyStateView">
+ <property name="icon-name">computer-fail-symbolic</property>
+ <property name="title" translatable="yes">No Timings Available</property>
+ <property name="subtitle" translatable="yes">No timing data was collected.</property>
+ <property name="visible">true</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]