[gnome-builder] build-manager: calculate error/warnings same as build panel



commit a7ddc1d5421b3a4d972ebc449ef28697fa3045cc
Author: Christian Hergert <chergert redhat com>
Date:   Fri Feb 23 01:02:44 2018 -0800

    build-manager: calculate error/warnings same as build panel
    
    We want to come up with the same value as the panel, so we need to count
    diagnostics by severity in the same way.
    
    Fixes #416

 src/libide/buildsystem/ide-build-manager.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-build-manager.c b/src/libide/buildsystem/ide-build-manager.c
index 0f6a83389..24dd83bde 100644
--- a/src/libide/buildsystem/ide-build-manager.c
+++ b/src/libide/buildsystem/ide-build-manager.c
@@ -194,6 +194,8 @@ ide_build_manager_handle_diagnostic (IdeBuildManager  *self,
                                      IdeDiagnostic    *diagnostic,
                                      IdeBuildPipeline *pipeline)
 {
+  IdeDiagnosticSeverity severity;
+
   IDE_ENTRY;
 
   g_assert (IDE_IS_BUILD_MANAGER (self));
@@ -202,18 +204,20 @@ ide_build_manager_handle_diagnostic (IdeBuildManager  *self,
 
   self->diagnostic_count++;
   if (self->diagnostic_count == 1)
-    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HAS_DIAGNOSTICS]);
+    g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_HAS_DIAGNOSTICS]);
 
-  if (ide_diagnostic_get_severity (diagnostic) > IDE_DIAGNOSTIC_WARNING)
-    {
-      self->error_count++;
-      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ERROR_COUNT]);
-    }
-  else
+  severity = ide_diagnostic_get_severity (diagnostic);
+
+  if (severity == IDE_DIAGNOSTIC_WARNING)
     {
       self->warning_count++;
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_WARNING_COUNT]);
     }
+  else if (severity == IDE_DIAGNOSTIC_ERROR || severity == IDE_DIAGNOSTIC_FATAL)
+    {
+      self->error_count++;
+      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ERROR_COUNT]);
+    }
 
   IDE_EXIT;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]