Moritz Neeb has proposed merging lp:~zormit/zeitgeist/fix-932989 into 
lp:zeitgeist.

Requested reviews:
  Zeitgeist Framework Team (zeitgeist)
Related bugs:
  Bug #932989 in Zeitgeist Framework: "Make FTS++ optional"
  https://bugs.launchpad.net/zeitgeist/+bug/932989

For more details, see:
https://code.launchpad.net/~zormit/zeitgeist/fix-932989/+merge/98760

Added an option for autogen.sh / configure : --disable-fts to compile without 
FTS++.
If zeitgeist-fts (aka SimpleIndexer at DBus) is not present, fts.vala 
unregisters a special monitor which was set up to wait for FTS and the 
extension itself.
-- 
https://code.launchpad.net/~zormit/zeitgeist/fix-932989/+merge/98760
Your team Zeitgeist Framework Team is requested to review the proposed merge of 
lp:~zormit/zeitgeist/fix-932989 into lp:zeitgeist.
=== modified file 'configure.ac'
--- configure.ac	2012-03-20 12:29:29 +0000
+++ configure.ac	2012-03-21 23:38:18 +0000
@@ -80,6 +80,18 @@
 DBUS_SERVICES_DIR="$services_dir"
 AC_SUBST(DBUS_SERVICES_DIR)
 
+
+#################################################
+# Configure options: --disable-fts.
+#################################################
+AC_ARG_ENABLE([fts],
+            AS_HELP_STRING([--disable-fts], [Build without FTS++ extension]))
+
+if test "x$enable_fts" = "x" ; then
+    enable_fts=yes
+fi
+AM_CONDITIONAL(HAVE_FTS, test "x$enable_fts" != "xno")
+
 AC_CONFIG_FILES([
 	Makefile
 	src/Makefile
@@ -131,6 +143,7 @@
     Install Prefix:     ${prefix}
 
   Optional dependencies
+    fts++:              ${enable_fts}
     dee-icu:            ${with_dee_icu}
 
 EOF

=== modified file 'extensions/Makefile.am'
--- extensions/Makefile.am	2012-02-15 18:27:21 +0000
+++ extensions/Makefile.am	2012-03-21 23:38:18 +0000
@@ -1,4 +1,6 @@
+if HAVE_FTS
 SUBDIRS = fts++
+endif
 
 NULL =
 

=== modified file 'extensions/fts.vala'
--- extensions/fts.vala	2012-02-10 17:03:50 +0000
+++ extensions/fts.vala	2012-03-21 23:38:18 +0000
@@ -95,24 +95,23 @@
 
                 // FIXME: shouldn't we delay this to next idle callback?
                 // Get SimpleIndexer
-                Bus.watch_name_on_connection (connection,
-                    INDEXER_NAME,
-                    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);
-                    },
-                    () => {});
+                if (siin != null) return;
+                connection.get_proxy.begin<RemoteSimpleIndexer> (
+                    "org.gnome.zeitgeist.SimpleIndexer",
+                    "/org/gnome/zeitgeist/index/activity",
+                    0, null, this.proxy_acquired);
             }
             catch (Error err)
             {
                 warning ("%s", err.message);
             }
         }
+        
+        private void proxy_not_present()
+        {
+            notifier.remove_monitor (new BusName (INDEXER_NAME),"/org/gnome/zeitgeist/monitor/special");
+            this.unload();
+        }
 
         private void proxy_acquired (Object? obj, AsyncResult res)
         {
@@ -120,7 +119,15 @@
             try
             {
                 siin = conn.get_proxy.end<RemoteSimpleIndexer> (res);
-                siin_connection_failed = false;
+                if((siin as DBusProxy).g_name_owner == null)
+                {
+                    this.proxy_not_present();
+                    siin_connection_failed = true; //TODO: Is this needed?
+                }
+                else
+                {
+                    siin_connection_failed = false;
+                }
             }
             catch (IOError err)
             {
@@ -147,6 +154,25 @@
                     "Not connected to SimpleIndexer");
             }
         }
+        
+        public override void unload ()
+        {
+            try
+            {
+                var connection = Bus.get_sync (BusType.SESSION, null);
+                if (registration_id != 0)
+                {
+                    connection.unregister_object (registration_id);
+                    registration_id = 0;
+                }
+            }
+            catch (Error err)
+            {
+                warning ("%s", err.message);
+            }
+
+            debug ("%s, this.ref_count = %u", Log.METHOD, this.ref_count);
+        }
 
         public async void search (string query_string, Variant time_range,
             Variant filter_templates, uint offset, uint count, uint result_type,

_______________________________________________
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