[gnome-builder] diagnostic-provider: add IdeDiagnosticProvider::invalidated signal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] diagnostic-provider: add IdeDiagnosticProvider::invalidated signal
- Date: Fri, 28 Oct 2016 01:39:35 +0000 (UTC)
commit 71aef68d81076e7d8ed83b6928efa4acb2421dd9
Author: Christian Hergert <chergert redhat com>
Date: Thu Oct 27 18:15:28 2016 -0700
diagnostic-provider: add IdeDiagnosticProvider::invalidated signal
This allows diagnostic providers to notify the system that their list of
diagnostics has changed out of band. This is useful for systems that do
not require a diagnose_async()/diagnose_finish() pair to get updates to
diagnostics.
libide/diagnostics/ide-diagnostic-provider.c | 28 ++++++++++++++++++++++++++
libide/diagnostics/ide-diagnostic-provider.h | 17 ++++++++-------
2 files changed, 37 insertions(+), 8 deletions(-)
---
diff --git a/libide/diagnostics/ide-diagnostic-provider.c b/libide/diagnostics/ide-diagnostic-provider.c
index af0a45f..60d1ba4 100644
--- a/libide/diagnostics/ide-diagnostic-provider.c
+++ b/libide/diagnostics/ide-diagnostic-provider.c
@@ -25,6 +25,13 @@
G_DEFINE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, IDE_TYPE_OBJECT)
+enum {
+ INVALIDATED,
+ N_SIGNALS
+};
+
+static guint signals [N_SIGNALS];
+
static void
ide_diagnostic_provider_default_init (IdeDiagnosticProviderInterface *iface)
{
@@ -34,6 +41,19 @@ ide_diagnostic_provider_default_init (IdeDiagnosticProviderInterface *iface)
"Context",
IDE_TYPE_CONTEXT,
(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)));
+
+ /**
+ * IdeDiagnosticProvider::invlaidated:
+ *
+ * This signal should be emitted by diagnostic providers when they know their
+ * diagnostics have been invalidated out-of-band.
+ */
+ signals [INVALIDATED] =
+ g_signal_new ("invalidated",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
+
}
void
@@ -67,3 +87,11 @@ ide_diagnostic_provider_diagnose_finish (IdeDiagnosticProvider *self,
return IDE_DIAGNOSTIC_PROVIDER_GET_IFACE (self)->diagnose_finish (self, result, error);
}
+
+void
+ide_diagnostic_provider_emit_invalidated (IdeDiagnosticProvider *self)
+{
+ g_return_if_fail (IDE_IS_DIAGNOSTIC_PROVIDER (self));
+
+ g_signal_emit (self, signals [INVALIDATED], 0);
+}
diff --git a/libide/diagnostics/ide-diagnostic-provider.h b/libide/diagnostics/ide-diagnostic-provider.h
index 517d21c..453cc2a 100644
--- a/libide/diagnostics/ide-diagnostic-provider.h
+++ b/libide/diagnostics/ide-diagnostic-provider.h
@@ -43,14 +43,15 @@ struct _IdeDiagnosticProviderInterface
GError **error);
};
-void ide_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *self,
- IdeFile *file,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-IdeDiagnostics *ide_diagnostic_provider_diagnose_finish (IdeDiagnosticProvider *self,
- GAsyncResult *result,
- GError **error);
+void ide_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *self,
+ IdeFile *file,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+IdeDiagnostics *ide_diagnostic_provider_diagnose_finish (IdeDiagnosticProvider *self,
+ GAsyncResult *result,
+ GError **error);
+void ide_diagnostic_provider_emit_invalidated (IdeDiagnosticProvider *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]