[gnome-builder] omnibar: notify user of build failure with bright red "Failed"
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] omnibar: notify user of build failure with bright red "Failed"
- Date: Tue, 28 Jun 2016 00:09:55 +0000 (UTC)
commit a33bf9968f238d35e14bbbe09266bdcbb09a9c7b
Author: Christian Hergert <chergert redhat com>
Date: Sun Jun 26 17:30:59 2016 -0700
omnibar: notify user of build failure with bright red "Failed"
libide/workbench/ide-omni-bar.c | 28 ++++++++++++++++++++++++++++
libide/workbench/ide-omni-bar.ui | 16 ++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/libide/workbench/ide-omni-bar.c b/libide/workbench/ide-omni-bar.c
index a9ef27a..32a7050 100644
--- a/libide/workbench/ide-omni-bar.c
+++ b/libide/workbench/ide-omni-bar.c
@@ -60,6 +60,7 @@ struct _IdeOmniBar
GtkLabel *popover_build_mode_label;
GtkLabel *popover_build_running_time_label;
GtkListBox *popover_configuration_list_box;
+ GtkLabel *popover_failed_label;
GtkLabel *popover_last_build_time_label;
GtkButton *popover_view_output_button;
GtkLabel *popover_project_label;
@@ -324,6 +325,22 @@ ide_omni_bar_build_result_notify_mode (IdeOmniBar *self,
}
static void
+ide_omni_bar_build_result_notify_failed (IdeOmniBar *self,
+ GParamSpec *pspec,
+ IdeBuildResult *result)
+{
+ gboolean failed;
+
+ g_assert (IDE_IS_OMNI_BAR (self));
+ g_assert (pspec != NULL);
+ g_assert (IDE_IS_BUILD_RESULT (result));
+
+ failed = ide_build_result_get_failed (result);
+
+ gtk_widget_set_visible (GTK_WIDGET (self->popover_failed_label), failed);
+}
+
+static void
ide_omni_bar_build_result_notify_running_time (IdeOmniBar *self,
GParamSpec *pspec,
IdeBuildResult *result)
@@ -555,6 +572,7 @@ ide_omni_bar_class_init (IdeOmniBarClass *klass)
gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_build_mode_label);
gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_build_running_time_label);
gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_configuration_list_box);
+ gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_failed_label);
gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_last_build_time_label);
gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_project_label);
gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_view_output_button);
@@ -591,6 +609,11 @@ ide_omni_bar_init (IdeOmniBar *self)
self->build_result_signals = egg_signal_group_new (IDE_TYPE_BUILD_RESULT);
egg_signal_group_connect_object (self->build_result_signals,
+ "notify::failed",
+ G_CALLBACK (ide_omni_bar_build_result_notify_failed),
+ self,
+ G_CONNECT_SWAPPED);
+ egg_signal_group_connect_object (self->build_result_signals,
"notify::mode",
G_CALLBACK (ide_omni_bar_build_result_notify_mode),
self,
@@ -647,6 +670,7 @@ ide_omni_bar_set_build_result (IdeOmniBar *self,
{
g_autoptr(GDateTime) now = NULL;
g_autofree gchar *nowstr = NULL;
+ gboolean failed = FALSE;
g_return_if_fail (IDE_IS_OMNI_BAR (self));
g_return_if_fail (!build_result || IDE_IS_BUILD_RESULT (build_result));
@@ -663,4 +687,8 @@ ide_omni_bar_set_build_result (IdeOmniBar *self,
gtk_label_set_label (self->popover_last_build_time_label, nowstr);
gtk_widget_show (GTK_WIDGET (self->popover_view_output_button));
+
+ if (build_result)
+ failed = ide_build_result_get_failed (build_result);
+ gtk_widget_set_visible (GTK_WIDGET (self->popover_failed_label), failed);
}
diff --git a/libide/workbench/ide-omni-bar.ui b/libide/workbench/ide-omni-bar.ui
index 5750dd5..1255cd7 100644
--- a/libide/workbench/ide-omni-bar.ui
+++ b/libide/workbench/ide-omni-bar.ui
@@ -259,6 +259,22 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="popover_failed_label">
+ <property name="label" translatable="yes">Failed</property>
+ <property name="xalign">1.0</property>
+ <property name="margin-end">8</property>
+ <property name="margin-start">8</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="foreground" value="red"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkButton" id="popover_view_output_button">
<property name="action-name">build-tools.view-output</property>
<property name="label" translatable="yes">View Output</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]