------------------------------------------------------------
revno: 280
committer: Seif Lotfy <s...@lotfy.com>
branch nick: bluebird
timestamp: Sun 2011-10-09 12:42:33 +0200
message:
  added temp fts solution 
  NEEDS FIXING
added:
  extensions/fts.vala
modified:
  extensions/Makefile.am
  src/Makefile.am
  src/engine.vala
  src/zeitgeist-daemon.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/Makefile.am'
--- extensions/Makefile.am	2011-09-29 15:30:04 +0000
+++ extensions/Makefile.am	2011-10-09 10:42:33 +0000
@@ -1,7 +1,7 @@
 NULL =
 
 #extensionsdir = $(libdir)/zeitgeist/extensions
-noinst_LTLIBRARIES = ds-registry.la blacklist.la storage-monitor.la
+noinst_LTLIBRARIES = ds-registry.la blacklist.la storage-monitor.la fts.la
 
 AM_CPPFLAGS = \
 	$(BLUEBIRD_CFLAGS) \
@@ -47,3 +47,14 @@
 storage_monitor_la_LIBADD = \
 	$(BLUEBIRD_LIBS) \
 	$(NULL)
+	
+
+fts_la_SOURCES = \
+	storage-monitor.la \
+	$(NULL)
+
+fts_la_LDFLAGS = -module -avoid-version
+
+fts_la_LIBADD = \
+	$(BLUEBIRD_LIBS) \
+	$(NULL)

=== added file 'extensions/fts.vala'
--- extensions/fts.vala	1970-01-01 00:00:00 +0000
+++ extensions/fts.vala	2011-10-09 10:42:33 +0000
@@ -0,0 +1,94 @@
+/* ds-registry.vala
+ *
+ * Copyright © 2011 Seif Lotfy <s...@lotfy.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Zeitgeist
+{
+    [DBus (name = "org.gnome.zeitgeist.Index")]
+    public interface RemoteSearchEngine: Object
+    {
+        [DBus (signature = "a(asaasay)u")]
+        public abstract 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;
+    }
+
+    [DBus (name = "org.gnome.zeitgeist.SimpleIndexer")]
+    public interface Siin : Object {
+        [DBus (signature = "a(asaasay)u")]
+        public signal 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;
+    }
+
+    public static string FTS_DATABASE_PATH;
+
+    class SearchEngine: Extension, RemoteSearchEngine
+    {
+        
+        private Siin siin = null; 
+        
+        SearchEngine ()
+        {
+            Object ();
+        }
+        
+        construct
+        {
+            try
+            {
+                siin = Bus.get_proxy_sync (BusType.SESSION, "org.gnome.zeitgeist.Index",
+                                                    "/org/gnome/zeitgeist/index/activity");
+                                                    
+                var connection = Bus.get_sync (BusType.SESSION, null);
+                registration_id = connection.register_object<RemoteSearchEngine> (
+                    "/org/gnome/zeitgeist/index/activity", this);
+            }
+            catch (Error err)
+            {
+                warning ("%s", err.message);
+            }
+
+            // Changes are saved to the DB every few seconds and at unload.
+            Timeout.add_seconds (DISK_WRITE_TIMEOUT, flush, Priority.LOW);
+        }
+        
+        public Variant search (string query_string, Variant time_range, 
+            Variant filter_templates, uint offset, uint count, uint result_type)
+        {
+        }
+
+    }
+
+    [ModuleInit]
+#if BUILTIN_EXTENSIONS
+    public static Type search_engine_init (TypeModule module)
+    {
+#else
+    public static Type extension_register (TypeModule module)
+    {
+#endif
+        return typeof (SearchEngine);
+    }
+}
+
+// vim:expandtab:ts=4:sw=4

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2011-09-29 15:30:04 +0000
+++ src/Makefile.am	2011-10-09 10:42:33 +0000
@@ -24,6 +24,7 @@
 	ext-blacklist.vala \
 	ext-histogram.vala \
 	ext-storage-monitor.vala \
+	ext-fts.vala \
 	$(NULL)
 
 bluebird_VALASOURCES = \

=== modified file 'src/engine.vala'
--- src/engine.vala	2011-09-28 12:51:08 +0000
+++ src/engine.vala	2011-10-09 10:42:33 +0000
@@ -570,6 +570,7 @@
         }
         database.end_transaction ();
         extension_collection.call_post_insert_events (events, sender);
+        debug("Inserted %lld events", events.length);
         return event_ids;
     }
 

=== modified file 'src/zeitgeist-daemon.vala'
--- src/zeitgeist-daemon.vala	2011-09-28 12:51:08 +0000
+++ src/zeitgeist-daemon.vala	2011-10-09 10:42:33 +0000
@@ -128,7 +128,9 @@
         public Variant get_events (uint32[] event_ids, BusName sender)
             throws Error
         {
+            var timer = new Timer ();
             GenericArray<Event> events = engine.get_events (event_ids);
+            debug ("%s executed in %f seconds", Log.METHOD, timer.elapsed ());
             return Events.to_variant (events);
         }
 

_______________________________________________
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