libsysprof-ui: add empty state for timing data

This commit is contained in:
Christian Hergert
2019-05-15 19:34:54 -07:00
parent c1d972d0c5
commit e3245c3c3b
3 changed files with 90 additions and 67 deletions

View File

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

View File

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

View File

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