[gnome-builder] diagnostics: add ide_diagnostics_add()



commit f1f6ba59d0bf3bbba7912124fff4a0df5e4610ed
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 27 18:14:25 2016 -0700

    diagnostics: add ide_diagnostics_add()
    
    This is a helper to add a diagnostic to the list, which is helpful when
    merging diagnostic sets in interesting new ways.

 libide/diagnostics/ide-diagnostics.c |   10 ++++++++++
 libide/diagnostics/ide-diagnostics.h |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/libide/diagnostics/ide-diagnostics.c b/libide/diagnostics/ide-diagnostics.c
index 8d8a2b6..140e082 100644
--- a/libide/diagnostics/ide-diagnostics.c
+++ b/libide/diagnostics/ide-diagnostics.c
@@ -153,3 +153,13 @@ ide_diagnostics_index (IdeDiagnostics *self,
 
   return g_ptr_array_index (self->diagnostics, index);
 }
+
+void
+ide_diagnostics_add (IdeDiagnostics *self,
+                     IdeDiagnostic  *diagnostic)
+{
+  g_assert (self != NULL);
+  g_assert (diagnostic != NULL);
+
+  g_ptr_array_add (self->diagnostics, ide_diagnostic_ref (diagnostic));
+}
diff --git a/libide/diagnostics/ide-diagnostics.h b/libide/diagnostics/ide-diagnostics.h
index 2429f09..ce419fa 100644
--- a/libide/diagnostics/ide-diagnostics.h
+++ b/libide/diagnostics/ide-diagnostics.h
@@ -34,6 +34,8 @@ IdeDiagnostic  *ide_diagnostics_index    (IdeDiagnostics *self,
 void            ide_diagnostics_merge    (IdeDiagnostics *self,
                                           IdeDiagnostics *other);
 IdeDiagnostics *ide_diagnostics_new      (GPtrArray      *ar);
+void            ide_diagnostics_add      (IdeDiagnostics *self,
+                                          IdeDiagnostic  *diagnostic);
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeDiagnostics, ide_diagnostics_unref)
 


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