[gnome-builder/wip/beniofel/vala-worker] create a dbus worker



commit c00fd548f87dc1426cace0a0301dc6700d81fa10
Author: Ben Iofel <iofelben gmail com>
Date:   Wed Jan 13 22:26:27 2016 -0500

    create a dbus worker

 libide/ide.h                                       |    1 +
 plugins/vala-pack/Makefile.am                      |    1 +
 .../vala-pack/ide-vala-completion-provider.vala    |    2 +-
 plugins/vala-pack/ide-vala-index.vala              |    4 ++
 plugins/vala-pack/ide-vala-worker.vala             |   33 ++++++++++++++++++++
 plugins/vala-pack/vala-pack-plugin.vala            |    1 +
 6 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide.h b/libide/ide.h
index df2eb80..252438c 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -115,6 +115,7 @@ G_BEGIN_DECLS
 #include "ide-workbench.h"
 #include "ide-workbench-addin.h"
 #include "ide-workbench-header-bar.h"
+#include "ide-worker.h"
 
 #include "editor/ide-editor-perspective.h"
 #include "editor/ide-editor-view.h"
diff --git a/plugins/vala-pack/Makefile.am b/plugins/vala-pack/Makefile.am
index 2d26850..6b5633c 100644
--- a/plugins/vala-pack/Makefile.am
+++ b/plugins/vala-pack/Makefile.am
@@ -19,6 +19,7 @@ libvala_pack_plugin_la_SOURCES = \
        ide-vala-source-file.vala \
        ide-vala-symbol-resolver.vala \
        ide-vala-symbol-tree.vala \
+       ide-vala-worker.vala \
        vala-pack-plugin.vala \
        $(NULL)
 
diff --git a/plugins/vala-pack/ide-vala-completion-provider.vala 
b/plugins/vala-pack/ide-vala-completion-provider.vala
index 62646ee..e6560cf 100644
--- a/plugins/vala-pack/ide-vala-completion-provider.vala
+++ b/plugins/vala-pack/ide-vala-completion-provider.vala
@@ -124,7 +124,7 @@ namespace Ide
                                        return false;
                        }
 
-                       if (Ide.CompletionProvider.context_in_comment (context))
+                       if (Ide.CompletionProvider.context_in_comment_or_string (context))
                                return false;
 
                        return true;
diff --git a/plugins/vala-pack/ide-vala-index.vala b/plugins/vala-pack/ide-vala-index.vala
index 6297b92..7bf6f99 100644
--- a/plugins/vala-pack/ide-vala-index.vala
+++ b/plugins/vala-pack/ide-vala-index.vala
@@ -93,6 +93,10 @@ namespace Ide
                        /* TODO: find packages from build system */
                        this.code_context.add_external_package ("gio-2.0");
                        this.code_context.add_external_package ("gtk+-3.0");
+                       this.code_context.add_external_package ("gtksourceview-3.0");
+                       this.code_context.add_external_package ("libide-1.0");
+                       this.code_context.add_external_package ("libpeas-1.0");
+                       this.code_context.add_external_package ("libvala-0.32");
 
                        this.report = new Ide.ValaDiagnostics ();
                        this.code_context.report = this.report;
diff --git a/plugins/vala-pack/ide-vala-worker.vala b/plugins/vala-pack/ide-vala-worker.vala
new file mode 100644
index 0000000..9ca1174
--- /dev/null
+++ b/plugins/vala-pack/ide-vala-worker.vala
@@ -0,0 +1,33 @@
+namespace Ide {
+       [DBus (name="org.gnome.builder.plugin.vala-pack")] // dbus interface name
+       public class ValaDBusService : Object {
+
+       }
+
+       [DBus (name="org.gnome.builder.plugin.vala-pack")] // dbus interface name
+       public interface ValaDBusClient : Object {
+
+       }
+
+       public class ValaWorker : Object, Ide.Worker {
+               public DBusProxy create_proxy (DBusConnection conn) throws IOError {
+                       ValaDBusClient client = conn.get_proxy_sync (
+                               null, // bus name
+                               "/",
+                               DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
+                               DBusProxyFlags.DO_NOT_CONNECT_SIGNALS |
+                               DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION,
+                               null);
+                       return client as DBusProxy;
+               }
+
+               public void register_service (DBusConnection conn) {
+                       try {
+                               conn.register_object ("/", new ValaDBusService ());
+                       } catch (IOError err) {
+                               critical ("Could not register ValaDBusService object: %s",
+                                       err.message);
+                       }
+               }
+       }
+}
diff --git a/plugins/vala-pack/vala-pack-plugin.vala b/plugins/vala-pack/vala-pack-plugin.vala
index b8553f9..f769dba 100644
--- a/plugins/vala-pack/vala-pack-plugin.vala
+++ b/plugins/vala-pack/vala-pack-plugin.vala
@@ -25,6 +25,7 @@ public void peas_register_types (GLib.TypeModule module)
 {
        Peas.ObjectModule peas = (Peas.ObjectModule)module;
 
+       peas.register_extension_type (typeof (Ide.Worker), typeof (Ide.ValaWorker));
        peas.register_extension_type (typeof (Ide.CompletionProvider), typeof (Ide.ValaCompletionProvider));
        peas.register_extension_type (typeof (Ide.DiagnosticProvider), typeof (Ide.ValaDiagnosticProvider));
        peas.register_extension_type (typeof (Ide.Indenter), typeof (Ide.ValaIndenter));


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