[gnome-builder] diagnostics: drop :context property



commit 0cef1bbcff63b6a77a30da30879233b733d7e422
Author: Christian Hergert <chergert redhat com>
Date:   Sat Mar 11 01:54:10 2017 -0800

    diagnostics: drop :context property
    
    We can drop this now as the context can be found from the base object.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779891

 libide/diagnostics/ide-diagnostic-provider.c       |   21 ++++++-------------
 libide/diagnostics/ide-diagnostic-provider.h       |    6 +---
 .../vala-pack/ide-vala-diagnostic-provider.vala    |   13 ++---------
 3 files changed, 12 insertions(+), 28 deletions(-)
---
diff --git a/libide/diagnostics/ide-diagnostic-provider.c b/libide/diagnostics/ide-diagnostic-provider.c
index 52cf62d..9b78a45 100644
--- a/libide/diagnostics/ide-diagnostic-provider.c
+++ b/libide/diagnostics/ide-diagnostic-provider.c
@@ -26,7 +26,7 @@
 #include "diagnostics/ide-diagnostics.h"
 #include "files/ide-file.h"
 
-G_DEFINE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, IDE_TYPE_OBJECT)
 
 enum {
   INVALIDATED,
@@ -38,13 +38,6 @@ static guint signals [N_SIGNALS];
 static void
 ide_diagnostic_provider_default_init (IdeDiagnosticProviderInterface *iface)
 {
-  g_object_interface_install_property (iface,
-                                       g_param_spec_object ("context",
-                                                            "Context",
-                                                            "Context",
-                                                            IDE_TYPE_CONTEXT,
-                                                            (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | 
G_PARAM_STATIC_STRINGS)));
-
   /**
    * IdeDiagnosticProvider::invlaidated:
    *
@@ -61,12 +54,12 @@ ide_diagnostic_provider_default_init (IdeDiagnosticProviderInterface *iface)
 
 /* If the file does not match a loaded buffer, buffer is %NULL */
 void
-ide_diagnostic_provider_diagnose_async  (IdeDiagnosticProvider *self,
-                                         IdeFile               *file,
-                                         IdeBuffer             *buffer,
-                                         GCancellable          *cancellable,
-                                         GAsyncReadyCallback    callback,
-                                         gpointer               user_data)
+ide_diagnostic_provider_diagnose_async (IdeDiagnosticProvider *self,
+                                        IdeFile               *file,
+                                        IdeBuffer             *buffer,
+                                        GCancellable          *cancellable,
+                                        GAsyncReadyCallback    callback,
+                                        gpointer               user_data)
 {
   IDE_ENTRY;
 
diff --git a/libide/diagnostics/ide-diagnostic-provider.h b/libide/diagnostics/ide-diagnostic-provider.h
index 5e746ad..3917954 100644
--- a/libide/diagnostics/ide-diagnostic-provider.h
+++ b/libide/diagnostics/ide-diagnostic-provider.h
@@ -25,14 +25,13 @@ G_BEGIN_DECLS
 
 #define IDE_TYPE_DIAGNOSTIC_PROVIDER (ide_diagnostic_provider_get_type())
 
-G_DECLARE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, IDE, DIAGNOSTIC_PROVIDER, GObject)
+G_DECLARE_INTERFACE (IdeDiagnosticProvider, ide_diagnostic_provider, IDE, DIAGNOSTIC_PROVIDER, IdeObject)
 
 struct _IdeDiagnosticProviderInterface
 {
   GTypeInterface parent_interface;
 
-  void            (*set_context)     (IdeDiagnosticProvider  *self,
-                                      IdeContext             *context);
+  void            (*load)            (IdeDiagnosticProvider  *self);
   void            (*diagnose_async)  (IdeDiagnosticProvider  *self,
                                       IdeFile                *file,
                                       IdeBuffer              *buffer,
@@ -42,7 +41,6 @@ struct _IdeDiagnosticProviderInterface
   IdeDiagnostics *(*diagnose_finish) (IdeDiagnosticProvider  *self,
                                       GAsyncResult           *result,
                                       GError                **error);
-  void            (*load)            (IdeDiagnosticProvider  *self);
 };
 
 void            ide_diagnostic_provider_diagnose_async   (IdeDiagnosticProvider  *self,
diff --git a/plugins/vala-pack/ide-vala-diagnostic-provider.vala 
b/plugins/vala-pack/ide-vala-diagnostic-provider.vala
index 4033294..c244414 100644
--- a/plugins/vala-pack/ide-vala-diagnostic-provider.vala
+++ b/plugins/vala-pack/ide-vala-diagnostic-provider.vala
@@ -22,26 +22,19 @@ using Vala;
 
 namespace Ide
 {
-       public class ValaDiagnosticProvider: GLib.Object, Ide.DiagnosticProvider
+       public class ValaDiagnosticProvider: Ide.Object, Ide.DiagnosticProvider
        {
                public async Ide.Diagnostics? diagnose_async (Ide.File file,
                                                              Ide.Buffer buffer,
                                                              GLib.Cancellable? cancellable)
                        throws GLib.Error
                {
-                       var service = (Ide.ValaService)_context.get_service_typed (typeof (Ide.ValaService));
-                       yield service.index.parse_file (file.file, _context.unsaved_files, cancellable);
+                       var service = (Ide.ValaService)get_context ().get_service_typed (typeof 
(Ide.ValaService));
+                       yield service.index.parse_file (file.file, get_context ().unsaved_files, cancellable);
                        var results = yield service.index.get_diagnostics (file.file, cancellable);
                        return results;
                }
 
                public void load () {}
-
-               // This code shouldn't have to exist.
-               // If we can fixup libide+vala to not have such weird interaction that
-               // would be great.
-               Ide.Context? _context;
-               public Ide.Context context { construct { _context = value; } }
-               public void set_context (Ide.Context context) { _context = context; }
        }
 }


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