[gnome-builder] libide: add text property to IdeDiagnostic



commit f6c71ebbd15b12500479cf685b7540618e5f68fb
Author: Christian Hergert <christian hergert me>
Date:   Wed Feb 11 23:35:09 2015 -0800

    libide: add text property to IdeDiagnostic

 libide/ide-diagnostic.c |   18 +++++++++++++++---
 libide/ide-diagnostic.h |    1 +
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-diagnostic.c b/libide/ide-diagnostic.c
index 6b45028..f2e7886 100644
--- a/libide/ide-diagnostic.c
+++ b/libide/ide-diagnostic.c
@@ -23,8 +23,9 @@ G_DEFINE_BOXED_TYPE (IdeDiagnostic, ide_diagnostic,
 
 struct _IdeDiagnostic
 {
-  volatile gint         ref_count;
-  IdeDiagnosticSeverity severity;
+  volatile gint          ref_count;
+  IdeDiagnosticSeverity  severity;
+  gchar                 *text;
 };
 
 IdeDiagnostic *
@@ -46,6 +47,7 @@ ide_diagnostic_unref (IdeDiagnostic *self)
 
   if (g_atomic_int_dec_and_test (&self->ref_count))
     {
+      g_free (self->text);
       g_slice_free (IdeDiagnostic, self);
     }
 }
@@ -58,14 +60,24 @@ ide_diagnostic_get_severity (IdeDiagnostic *self)
   return self->severity;
 }
 
+const gchar *
+ide_diagnostic_get_text (IdeDiagnostic *self)
+{
+  g_return_val_if_fail (self, NULL);
+
+  return self->text;
+}
+
 IdeDiagnostic *
-_ide_diagnostic_new (IdeDiagnosticSeverity severity)
+_ide_diagnostic_new (IdeDiagnosticSeverity  severity,
+                     const gchar           *text)
 {
   IdeDiagnostic *ret;
 
   ret = g_slice_new0 (IdeDiagnostic);
   ret->ref_count = 1;
   ret->severity = severity;
+  ret->text = g_strdup (text);
 
   return ret;
 }
diff --git a/libide/ide-diagnostic.h b/libide/ide-diagnostic.h
index 8a3b5d6..14fa8e6 100644
--- a/libide/ide-diagnostic.h
+++ b/libide/ide-diagnostic.h
@@ -38,6 +38,7 @@ 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);
+const gchar           *ide_diagnostic_get_text     (IdeDiagnostic *self);
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeDiagnostic, ide_diagnostic_unref)
 


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