← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 283: Workaround a Vala bug

 

------------------------------------------------------------
revno: 283
committer: Michal Hruby <michal.mhr@xxxxxxxxx>
branch nick: bb-fts
timestamp: Sun 2011-10-09 16:56:20 +0200
message:
  Workaround a Vala bug
modified:
  extensions/fts.vala
  src/remote.vala


--
lp:~zeitgeist/zeitgeist/bluebird
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:~zeitgeist/zeitgeist/bluebird.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'extensions/fts.vala'
--- extensions/fts.vala	2011-10-09 12:24:25 +0000
+++ extensions/fts.vala	2011-10-09 14:56:20 +0000
@@ -23,23 +23,27 @@
     public interface RemoteSearchEngine: Object
     {
         [DBus (signature = "a(asaasay)u")]
-        public abstract Variant search (
+        public abstract async Variant search (
             string query_string,
             [DBus (signature = "(xx)")] Variant time_range,
             [DBus (signature = "a(asaasay)")] Variant filter_templates,
             uint offset, uint count, uint result_type) throws Error;
     }
 
+    /* Because of a Vala bug we have to define the proxy interface outside of
+     * [ModuleInit] source */
+    /*
     [DBus (name = "org.gnome.zeitgeist.SimpleIndexer")]
     public interface RemoteSimpleIndexer : Object
     {
         [DBus (signature = "a(asaasay)u")]
-        public abstract Variant search (
+        public abstract async Variant search (
             string query_string,
             [DBus (signature = "(xx)")] Variant time_range,
             [DBus (signature = "a(asaasay)")] Variant filter_templates,
             uint offset, uint count, uint result_type) throws Error;
     }
+    */
 
     class SearchEngine: Extension, RemoteSearchEngine
     {
@@ -61,7 +65,7 @@
                     "/org/gnome/zeitgeist/index/activity", this);
 
                 // Get SimpleIndexer
-                siin = Bus.get_proxy_sync (BusType.SESSION,
+                siin = Bus.get_proxy_sync<RemoteSimpleIndexer> (BusType.SESSION,
                     "org.gnome.zeitgeist.Index",
                     "/org/gnome/zeitgeist/index/activity");
             }
@@ -71,11 +75,13 @@
             }
         }
 
-        public Variant search (string query_string, Variant time_range,
+        public async Variant search (string query_string, Variant time_range,
             Variant filter_templates, uint offset, uint count, uint result_type)
+            throws Error
         {
-            return siin.search (query_string, time_range, filter_templates,
-                offset, count, result_type);
+            var result = yield siin.search (query_string, time_range,
+                filter_templates, offset, count, result_type);
+            return result;
         }
 
     }

=== modified file 'src/remote.vala'
--- src/remote.vala	2011-08-29 20:57:10 +0000
+++ src/remote.vala	2011-10-09 14:56:20 +0000
@@ -107,6 +107,18 @@
 
     }
 
+    /* FIXME: Remove this! Only here because of a bug in Vala (see ext-fts) */
+    [DBus (name = "org.gnome.zeitgeist.SimpleIndexer")]
+    public interface RemoteSimpleIndexer : Object
+    {
+        [DBus (signature = "a(asaasay)u")]
+        public abstract async Variant search (
+            string query_string,
+            [DBus (signature = "(xx)")] Variant time_range,
+            [DBus (signature = "a(asaasay)")] Variant filter_templates,
+            uint offset, uint count, uint result_type) throws Error;
+    }
+
 }
 
 // vim:expandtab:ts=4:sw=4