[gnome-builder/wip/chergert/headerbar] build-result: add IdeBuildResult:failed property
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/headerbar] build-result: add IdeBuildResult:failed property
- Date: Mon, 27 Jun 2016 00:31:08 +0000 (UTC)
commit 54450eb6076211be618d0c23a6e795edf74902c4
Author: Christian Hergert <chergert redhat com>
Date: Sun Jun 26 17:30:11 2016 -0700
build-result: add IdeBuildResult:failed property
This allows a more simplistic way for consumers to know of the build was
"not successful". Otherwise, all the mode strings are build system specific
and generally less than useful for this.
libide/buildsystem/ide-build-result.c | 50 +++++++++++++++++++++++++++++++++
libide/buildsystem/ide-build-result.h | 3 ++
2 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-result.c b/libide/buildsystem/ide-build-result.c
index b065ffe..6e7045e 100644
--- a/libide/buildsystem/ide-build-result.c
+++ b/libide/buildsystem/ide-build-result.c
@@ -54,6 +54,7 @@ typedef struct
GSource *running_time_source;
guint running : 1;
+ guint failed : 1;
} IdeBuildResultPrivate;
typedef struct
@@ -67,6 +68,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (IdeBuildResult, ide_build_result, IDE_TYPE_OBJECT)
enum {
PROP_0,
+ PROP_FAILED,
PROP_MODE,
PROP_RUNNING,
PROP_RUNNING_TIME,
@@ -508,6 +510,10 @@ ide_build_result_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_FAILED:
+ g_value_set_boolean (value, ide_build_result_get_failed (self));
+ break;
+
case PROP_MODE:
g_value_take_string (value, ide_build_result_get_mode (self));
break;
@@ -535,6 +541,10 @@ ide_build_result_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_FAILED:
+ ide_build_result_set_failed (self, g_value_get_boolean (value));
+ break;
+
case PROP_MODE:
ide_build_result_set_mode (self, g_value_get_string (value));
break;
@@ -558,6 +568,13 @@ ide_build_result_class_init (IdeBuildResultClass *klass)
object_class->get_property = ide_build_result_get_property;
object_class->set_property = ide_build_result_set_property;
+ properties [PROP_FAILED] =
+ g_param_spec_boolean ("failed",
+ "Failed",
+ "Failed",
+ FALSE,
+ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY));
+
properties [PROP_MODE] =
g_param_spec_string ("mode",
"Mode",
@@ -765,3 +782,36 @@ ide_build_result_emit_diagnostic (IdeBuildResult *self,
g_timeout_add (0, ide_build_result_emit_diagnostic_cb, pair);
}
+
+void
+ide_build_result_set_failed (IdeBuildResult *self,
+ gboolean failed)
+{
+ IdeBuildResultPrivate *priv = ide_build_result_get_instance_private (self);
+ gboolean notify = FALSE;
+
+ g_return_if_fail (IDE_IS_BUILD_RESULT (self));
+
+ failed = !!failed;
+
+ g_mutex_lock (&priv->mutex);
+ if (failed != priv->failed)
+ {
+ priv->failed = failed;
+ notify = TRUE;
+ }
+ g_mutex_unlock (&priv->mutex);
+
+ if (notify)
+ ide_object_notify_in_main (self, properties [PROP_FAILED]);
+}
+
+gboolean
+ide_build_result_get_failed (IdeBuildResult *self)
+{
+ IdeBuildResultPrivate *priv = ide_build_result_get_instance_private (self);
+
+ g_return_val_if_fail (IDE_IS_BUILD_RESULT (self), FALSE);
+
+ return priv->failed;
+}
diff --git a/libide/buildsystem/ide-build-result.h b/libide/buildsystem/ide-build-result.h
index b5b1189..4d24b2f 100644
--- a/libide/buildsystem/ide-build-result.h
+++ b/libide/buildsystem/ide-build-result.h
@@ -56,6 +56,9 @@ GTimeSpan ide_build_result_get_running_time (IdeBuildResult *self);
gboolean ide_build_result_get_running (IdeBuildResult *self);
void ide_build_result_set_running (IdeBuildResult *self,
gboolean running);
+gboolean ide_build_result_get_failed (IdeBuildResult *self);
+void ide_build_result_set_failed (IdeBuildResult *self,
+ gboolean failed);
void ide_build_result_emit_diagnostic (IdeBuildResult *self,
IdeDiagnostic *diagnostic);
gchar *ide_build_result_get_mode (IdeBuildResult *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]