[gnome-builder] build-panel: add empty state view for build panel
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] build-panel: add empty state view for build panel
- Date: Tue, 18 Oct 2016 00:04:10 +0000 (UTC)
commit b14a020b669dbeeea9e4c13aa2c0124e2f29d537
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 17 17:02:38 2016 -0700
build-panel: add empty state view for build panel
This panel does not really indicate what it does when a build has not yet
been performed. So this gives a handy empty state message and action link
to submit a build of the project.
plugins/build-tools/gbp-build-panel.c | 5 +++
plugins/build-tools/gbp-build-panel.ui | 52 +++++++++++++++++++++----------
2 files changed, 40 insertions(+), 17 deletions(-)
---
diff --git a/plugins/build-tools/gbp-build-panel.c b/plugins/build-tools/gbp-build-panel.c
index cde0c92..ba22ce4 100644
--- a/plugins/build-tools/gbp-build-panel.c
+++ b/plugins/build-tools/gbp-build-panel.c
@@ -39,6 +39,7 @@ struct _GbpBuildPanel
GtkTreeView *diagnostics_tree_view;
GtkLabel *errors_label;
GtkLabel *running_time_label;
+ GtkStack *stack;
GtkRevealer *status_revealer;
GtkLabel *status_label;
GtkLabel *warnings_label;
@@ -187,6 +188,8 @@ gbp_build_panel_connect (GbpBuildPanel *self,
egg_binding_group_set_source (self->bindings, result);
gtk_revealer_set_reveal_child (self->status_revealer, TRUE);
+
+ gtk_stack_set_visible_child_name (self->stack, "diagnostics");
}
static void
@@ -201,6 +204,7 @@ gbp_build_panel_disconnect (GbpBuildPanel *self)
g_clear_object (&self->result);
g_hash_table_remove_all (self->diags_hash);
gtk_list_store_clear (self->diagnostics_store);
+ gtk_stack_set_visible_child_name (self->stack, "empty-state");
}
void
@@ -430,6 +434,7 @@ gbp_build_panel_class_init (GbpBuildPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, GbpBuildPanel, diagnostics_tree_view);
gtk_widget_class_bind_template_child (widget_class, GbpBuildPanel, errors_label);
gtk_widget_class_bind_template_child (widget_class, GbpBuildPanel, running_time_label);
+ gtk_widget_class_bind_template_child (widget_class, GbpBuildPanel, stack);
gtk_widget_class_bind_template_child (widget_class, GbpBuildPanel, status_label);
gtk_widget_class_bind_template_child (widget_class, GbpBuildPanel, status_revealer);
gtk_widget_class_bind_template_child (widget_class, GbpBuildPanel, warnings_label);
diff --git a/plugins/build-tools/gbp-build-panel.ui b/plugins/build-tools/gbp-build-panel.ui
index 8f3a1da..a2d3662 100644
--- a/plugins/build-tools/gbp-build-panel.ui
+++ b/plugins/build-tools/gbp-build-panel.ui
@@ -138,33 +138,51 @@
</object>
</child>
<child>
- <object class="GtkScrolledWindow">
- <property name="hscrollbar-policy">never</property>
- <property name="vexpand">true</property>
+ <object class="GtkStack" id="stack">
<property name="visible">true</property>
<child>
- <object class="GtkTreeView" id="diagnostics_tree_view">
- <property name="activate-on-single-click">true</property>
- <property name="tooltip-column">1</property>
- <property name="model">diagnostics_store</property>
- <property name="headers-visible">false</property>
+ <object class="EggEmptyState">
+ <property name="icon-name">builder-build-symbolic</property>
+ <property name="subtitle" translatable="yes" comments="the action:// link is used to execute
a build"><a href="action://build-manager.build">Build your project</a> to show diagnostics
here</property>
+ <property name="visible">true</property>
+ </object>
+ <packing>
+ <property name="name">empty-state</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="hscrollbar-policy">never</property>
+ <property name="vexpand">true</property>
<property name="visible">true</property>
<child>
- <object class="GtkTreeViewColumn" id="diagnostics_column">
- <property name="expand">true</property>
+ <object class="GtkTreeView" id="diagnostics_tree_view">
+ <property name="activate-on-single-click">true</property>
+ <property name="tooltip-column">1</property>
+ <property name="model">diagnostics_store</property>
+ <property name="headers-visible">false</property>
+ <property name="visible">true</property>
<child>
- <object class="GtkCellRendererText" id="diagnostics_text">
- <property name="yalign">0.0</property>
- <property name="xalign">0.0</property>
- <property name="ypad">6</property>
- <property name="width-chars">0</property>
- <property name="ellipsize">end</property>
- <property name="wrap-mode">word-char</property>
+ <object class="GtkTreeViewColumn" id="diagnostics_column">
+ <property name="expand">true</property>
+ <child>
+ <object class="GtkCellRendererText" id="diagnostics_text">
+ <property name="yalign">0.0</property>
+ <property name="xalign">0.0</property>
+ <property name="ypad">6</property>
+ <property name="width-chars">0</property>
+ <property name="ellipsize">end</property>
+ <property name="wrap-mode">word-char</property>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="name">diagnostics</property>
+ </packing>
</child>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]