← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 455: Make FTS++ optional.

 

Merge authors:
  Moritz Neeb (zormit)
Related merge proposals:
  https://code.launchpad.net/~zormit/zeitgeist/fix-932989/+merge/98760
  proposed by: Moritz Neeb (zormit)
  review: Approve - Michal Hruby (mhr3)
  review: Resubmit - Moritz Neeb (zormit)
------------------------------------------------------------
revno: 455 [merge]
committer: Seif Lotfy <seif@xxxxxxxxx>
branch nick: zeitgeist
timestamp: Thu 2012-03-29 12:54:52 +0200
message:
   Make FTS++ optional.
  * Make the fts.vala extension behave if FTS++ isn't there.
modified:
  configure.ac
  extensions/Makefile.am
  extensions/fts.vala


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

Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'configure.ac'
--- configure.ac	2012-03-20 12:29:29 +0000
+++ configure.ac	2012-03-29 10:54:52 +0000
@@ -80,6 +80,16 @@
 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]),
+            [enable_fts=$enableval],[enable_fts="yes"])
+
+AM_CONDITIONAL(HAVE_FTS, test "x$enable_fts" != "xno")
+
 AC_CONFIG_FILES([
 	Makefile
 	src/Makefile
@@ -131,6 +141,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-15 21:36:10 +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-26 20:49:32 +0000
@@ -95,24 +95,22 @@
 
                 // FIXME: shouldn't we delay this to next idle callback?
                 // Get SimpleIndexer
-                Bus.watch_name_on_connection (connection,
+                connection.get_proxy.begin<RemoteSimpleIndexer> (
                     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);
-                    },
-                    () => {});
+                    "/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 +118,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;
+                }
+                else
+                {
+                    siin_connection_failed = false;
+                }
             }
             catch (IOError err)
             {
@@ -147,6 +153,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,