------------------------------------------------------------
revno: 301
committer: Michal Hruby <michal....@gmail.com>
branch nick: bb-fts
timestamp: Wed 2011-10-12 17:10:23 +0200
message:
  Fix FTS handling
modified:
  extensions/fts.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-10 14:44:49 +0000
+++ extensions/fts.vala	2011-10-12 15:10:23 +0000
@@ -65,10 +65,20 @@
                 registration_id = connection.register_object<RemoteSearchEngine> (
                     "/org/gnome/zeitgeist/index/activity", this);
 
+                // FIXME: shouldn't we delay this to next idle callback?
                 // Get SimpleIndexer
-                siin = Bus.get_proxy_sync<RemoteSimpleIndexer> (BusType.SESSION,
+                Bus.watch_name_on_connection (connection,
                     "org.gnome.zeitgeist.SimpleIndexer",
-                    "/org/gnome/zeitgeist/index/activity");
+                    BusNameWatcherFlags.AUTO_START,
+                    (conn) =>
+                    {
+                        if (siin != null) return;
+                        conn.get_proxy.begin<RemoteSimpleIndexer> (
+                            "org.gnome.zeitgeist.SimpleIndexer",
+                            "/org/gnome/zeitgeist/index/activity",
+                            0, null, this.proxy_acquired);
+                    },
+                    () => {});
             }
             catch (Error err)
             {
@@ -76,6 +86,19 @@
             }
         }
 
+        private void proxy_acquired (Object? obj, AsyncResult res)
+        {
+            var conn = obj as DBusConnection;
+            try
+            {
+                siin = conn.get_proxy.end<RemoteSimpleIndexer> (res);
+            }
+            catch (IOError err)
+            {
+                warning ("%s", err.message);
+            }
+        }
+
         /* This whole method is one huge workaround for an issue with Vala 
          * enclosing all out/return parameters in a TUPLE variant */
         public async Variant search (string query_string, Variant time_range,
@@ -85,6 +108,7 @@
             debug ("Performing search for %s", query_string);
             if (siin == null || !(siin is DBusProxy))
             {
+                // FIXME: queue until we have the proxy
                 throw new EngineError.DATABASE_ERROR (
                     "Not connected to SimpleIndexer");
             }

_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to