[gnome-builder] service: drop context property from IdeService



commit eb7bc79c4e0200d8425538b42494f82306f53033
Author: Christian Hergert <chergert redhat com>
Date:   Sat Mar 11 01:49:05 2017 -0800

    service: drop context property from IdeService
    
    Now that IdeService can have :context fulfilled from IdeObject when
    creating plugins, we can simplify this code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779891

 libide/ide-service.c                    |   13 +++----------
 libide/ide-service.h                    |    4 +---
 plugins/vala-pack/ide-vala-service.vala |   22 +++-------------------
 3 files changed, 7 insertions(+), 32 deletions(-)
---
diff --git a/libide/ide-service.c b/libide/ide-service.c
index eedb7d3..93ba2c0 100644
--- a/libide/ide-service.c
+++ b/libide/ide-service.c
@@ -21,14 +21,14 @@
 #include "ide-context.h"
 #include "ide-service.h"
 
-G_DEFINE_INTERFACE (IdeService, ide_service, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (IdeService, ide_service, IDE_TYPE_OBJECT)
 
 enum {
   CONTEXT_LOADED,
-  LAST_SIGNAL
+  N_SIGNALS
 };
 
-static guint signals [LAST_SIGNAL];
+static guint signals [N_SIGNALS];
 
 const gchar *
 ide_service_get_name (IdeService *service)
@@ -75,13 +75,6 @@ ide_service_default_init (IdeServiceInterface *iface)
 {
   iface->get_name = ide_service_real_get_name;
 
-  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)));
-
   signals [CONTEXT_LOADED] =
     g_signal_new ("context-loaded",
                   G_TYPE_FROM_INTERFACE (iface),
diff --git a/libide/ide-service.h b/libide/ide-service.h
index 2fd7448..efa7c81 100644
--- a/libide/ide-service.h
+++ b/libide/ide-service.h
@@ -25,7 +25,7 @@ G_BEGIN_DECLS
 
 #define IDE_TYPE_SERVICE (ide_service_get_type())
 
-G_DECLARE_INTERFACE (IdeService, ide_service, IDE, SERVICE, GObject)
+G_DECLARE_INTERFACE (IdeService, ide_service, IDE, SERVICE, IdeObject)
 
 struct _IdeServiceInterface
 {
@@ -35,8 +35,6 @@ struct _IdeServiceInterface
   const gchar *(*get_name)       (IdeService *service);
   void         (*start)          (IdeService *service);
   void         (*stop)           (IdeService *service);
-  void         (*set_context)    (IdeService *service,
-                                  IdeContext *context);
 };
 
 const gchar *ide_service_get_name (IdeService *self);
diff --git a/plugins/vala-pack/ide-vala-service.vala b/plugins/vala-pack/ide-vala-service.vala
index e6ab84f..ad904fc 100644
--- a/plugins/vala-pack/ide-vala-service.vala
+++ b/plugins/vala-pack/ide-vala-service.vala
@@ -22,13 +22,9 @@ using Vala;
 
 namespace Ide
 {
-       public class ValaService: GLib.Object, Ide.Service
+       public class ValaService: Ide.Object, Ide.Service
        {
                Ide.ValaIndex _index;
-               Ide.Context? _context;
-
-               construct {
-               }
 
                public ValaIndex index {
                        get { return this._index; }
@@ -39,10 +35,10 @@ namespace Ide
                }
 
                public void start () {
-                       this._index = new Ide.ValaIndex (this._context);
+                       this._index = new Ide.ValaIndex (this.get_context ());
 
                        Ide.ThreadPool.push (Ide.ThreadPoolKind.INDEXER, () => {
-                               Ide.Vcs vcs = this._context.get_vcs ();
+                               Ide.Vcs vcs = this.get_context ().get_vcs ();
                                var files = new ArrayList<GLib.File> ();
 
                                load_directory (vcs.get_working_directory (), null, files);
@@ -85,17 +81,5 @@ namespace Ide
                                warning ("%s", err.message);
                        }
                }
-
-               // This code shouldn't have to exist.
-               // If we can fixup libide+vala to not have such weird interaction that
-               // would be great.
-
-               public Ide.Context context {
-                       construct { this._context = value; }
-               }
-
-               public void set_context (Ide.Context context) {
-                       this._context = context;
-               }
        }
 }


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