[gnome-builder/wip/libide: 116/153] libide: add severity to IdeDiagnostic



commit 7e6692a4f4547ca6b388ed62c5bfc602868d8c0c
Author: Christian Hergert <christian hergert me>
Date:   Wed Feb 11 22:29:48 2015 -0800

    libide: add severity to IdeDiagnostic

 libide/ide-diagnostic.c |   22 +++++++++++++++++++++-
 libide/ide-diagnostic.h |   16 +++++++++++++---
 2 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/libide/ide-diagnostic.c b/libide/ide-diagnostic.c
index 856c0bd..6b45028 100644
--- a/libide/ide-diagnostic.c
+++ b/libide/ide-diagnostic.c
@@ -23,7 +23,8 @@ G_DEFINE_BOXED_TYPE (IdeDiagnostic, ide_diagnostic,
 
 struct _IdeDiagnostic
 {
-  volatile gint ref_count;
+  volatile gint         ref_count;
+  IdeDiagnosticSeverity severity;
 };
 
 IdeDiagnostic *
@@ -49,3 +50,22 @@ ide_diagnostic_unref (IdeDiagnostic *self)
     }
 }
 
+IdeDiagnosticSeverity
+ide_diagnostic_get_severity (IdeDiagnostic *self)
+{
+  g_return_val_if_fail (self, IDE_DIAGNOSTIC_IGNORED);
+
+  return self->severity;
+}
+
+IdeDiagnostic *
+_ide_diagnostic_new (IdeDiagnosticSeverity severity)
+{
+  IdeDiagnostic *ret;
+
+  ret = g_slice_new0 (IdeDiagnostic);
+  ret->ref_count = 1;
+  ret->severity = severity;
+
+  return ret;
+}
diff --git a/libide/ide-diagnostic.h b/libide/ide-diagnostic.h
index 0c934b7..42b6910 100644
--- a/libide/ide-diagnostic.h
+++ b/libide/ide-diagnostic.h
@@ -25,9 +25,19 @@ G_BEGIN_DECLS
 
 #define IDE_TYPE_DIAGNOSTIC (ide_diagnostic_get_type())
 
-GType          ide_diagnostic_get_type (void);
-IdeDiagnostic *ide_diagnostic_ref      (IdeDiagnostic *self);
-void           ide_diagnostic_unref    (IdeDiagnostic *self);
+typedef enum
+{
+  IDE_DIAGNOSTIC_IGNORED = 0,
+  IDE_DIAGNOSTIC_NOTE,
+  IDE_DIAGNOSTIC_WARNING,
+  IDE_DIAGNOSTIC_ERROR,
+  IDE_DIAGNOSTIC_FATAL,
+} IdeDiagnosticSeverity;
+
+GType                  ide_diagnostic_get_type     (void);
+IdeDiagnostic         *ide_diagnostic_ref          (IdeDiagnostic *self);
+void                   ide_diagnostic_unref        (IdeDiagnostic *self);
+IdeDiagnosticSeverity  ide_diagnostic_get_severity (IdeDiagnostic *self);
 
 G_END_DECLS
 


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