Hi folks,

This patch adds support for the metadata cache format[1] to Jürg's git
repository[2].

[1] http://live.gnome.org/MetadataOnRemovableDevices
[2] git.codethink.co.uk/git/tracker , branch vstore

The patch still contains hot steaming debug code and stuff, and is not
yet ready for commit. But this way people can study how this will work
already.


-- 
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://pvanhoof.be/blog
http://codeminded.be
diff --git a/configure.ac b/configure.ac
index b075f85..0614e78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,15 @@ AC_SUBST(GCONF_LIBS)
 
 AM_CONDITIONAL(HAVE_GCONF, test "$have_gconf" = "yes")
 
+# Check for Raptor
+PKG_CHECK_MODULES(RAPTOR, [raptor], have_raptor=yes, have_raptor=no)
+AC_SUBST(RAPTOR_CFLAGS)
+AC_SUBST(RAPTOR_LIBS)
+
+if test x$have_raptor == "xyes"; then
+  AC_DEFINE(HAVE_RAPTOR, 1, [Raptor RDF parsers])
+fi
+
 # Check we have the DBUS binding tool we need
 AC_PATH_PROG(DBUSBINDINGTOOL, dbus-binding-tool)
 if test -z $DBUSBINDINGTOOL; then
@@ -1054,6 +1063,8 @@ AC_CONFIG_LINKS(tests/tracker-indexer/tracker-dbus.c:src/tracker-indexer/tracker
                 tests/tracker-indexer/tracker-metadata-utils.c:src/tracker-indexer/tracker-metadata-utils.c
                 tests/tracker-indexer/tracker-metadata-utils.h:src/tracker-indexer/tracker-metadata-utils.h
                 tests/tracker-indexer/tracker-module.h:src/tracker-indexer/tracker-module.h
+		tests/tracker-indexer/tracker-turtle.h:src/tracker-indexer/tracker-turtle.h
+		tests/tracker-indexer/tracker-turtle.c:src/tracker-indexer/tracker-turtle.c
 )
 
 ##################################################################
diff --git a/data/dbus/tracker-indexer.xml b/data/dbus/tracker-indexer.xml
index cfeb40c..a4741c9 100644
--- a/data/dbus/tracker-indexer.xml
+++ b/data/dbus/tracker-indexer.xml
@@ -11,6 +11,11 @@
 
 <node name="/">
   <interface name="org.freedesktop.Tracker.Indexer">  
+    <method name="TurtleAdd">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+      <arg type="s" name="file" direction="in" />
+    </method>
+
     <method name="FilesCheck">
       <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
       <arg type="s" name="module" direction="in" />
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 9012799..9ddac17 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -143,6 +143,177 @@ tracker_data_update_create_event (TrackerDBInterface *iface,
 	g_free (service_id_str);
 }
 
+void 
+tracker_data_replace_service (const gchar *path,
+			      GHashTable *metadata)
+{
+	TrackerDBInterface  *iface;
+	const gchar         *service_type = "Files";
+	const gchar         *predicate = "File:";
+	TrackerDBResultSet  *result_set;
+	gchar               *modified;
+	gchar               *rdf_type;
+	GError              *error = NULL;
+
+	rdf_type = g_hash_table_lookup (metadata, "rdf:type");
+
+	if (!rdf_type)
+		return;
+
+	if (strcmp (rdf_type, "Email") == 0) {
+		service_type = "Emails";
+		predicate = "Email:";
+	}
+
+	modified = g_hash_table_lookup (metadata, "File:Modified");
+
+	if (!modified)
+		return;
+
+	iface = tracker_db_manager_get_db_interface_by_type (service_type,
+							     TRACKER_DB_CONTENT_TYPE_METADATA_DECOMPOSED);
+
+	g_print ("SELECT ID, \"%sModified\" < '%s' FROM %s "
+		 "WHERE Path || '/' || Name = '%s'\n",
+		 predicate,
+		 modified,
+		 service_type, /* I know, it's the same atm though */
+		 path);
+
+	result_set = tracker_db_interface_execute_query (iface, &error,
+							 "SELECT ID, \"%sModified\" < '%s' FROM %s "
+							 "WHERE Path || '/' || Name = '%s'",
+							 predicate,
+							 modified,
+							 service_type, /* I know, it's the same atm though */
+							 path);
+
+	if (error) {
+		g_print ("Q ERROR: %s\n", error->message);
+		g_error_free (error);
+	}
+
+	if (result_set) {
+		GValue         id_value = { 0, };
+		GValue         is_value = { 0, };
+		gint           iid_value, iis_value;
+
+		_tracker_db_result_set_get_value (result_set, 0, &id_value);
+		iid_value = g_value_get_int (&id_value);
+
+		_tracker_db_result_set_get_value (result_set, 1, &is_value);
+		iis_value = g_value_get_int (&is_value);
+
+		if (iis_value) {
+			GHashTableIter iter;
+			gpointer       hkey, hvalue;
+
+			g_hash_table_iter_init (&iter, metadata);
+
+			g_print ("Update for %s: (%d)\n", path, iid_value);
+
+			while (g_hash_table_iter_next (&iter, &hkey, &hvalue)) {
+				TrackerField *field = tracker_ontology_get_field_by_name (hkey);
+				if (field) {
+					TrackerService *service = tracker_field_get_service (field);
+					TrackerDBInterface *uiface;
+					GError *uerror = NULL;
+
+					uiface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
+											      TRACKER_DB_CONTENT_TYPE_METADATA_DECOMPOSED);
+
+					tracker_db_interface_execute_query (uiface, &uerror,
+						"UPDATE \"%s\" SET \"%s\" = '%s' WHERE ID = %d",
+							tracker_service_get_name (service),
+							(gchar*) hkey, (gchar*) hvalue, iid_value);
+
+					g_print ("UPDATE \"%s\" SET \"%s\" = '%s' WHERE ID = %d\n",
+							tracker_service_get_name (service),
+							(gchar*) hkey, (gchar*) hvalue, iid_value);
+
+					if (uerror) {
+						g_print ("UPDATE ERROR: %s\n", uerror->message);
+						g_error_free (uerror);
+					}
+				}
+			}
+			g_print ("END\n");
+
+		}
+
+		g_value_unset (&id_value);
+		g_value_unset (&is_value);
+
+		g_object_unref (result_set);
+
+	} else {
+		GHashTableIter  iter;
+		gpointer        hkey, hvalue;
+		gchar          *dirname, *filename;
+		guint32         id;
+		TrackerService *service;
+		GError         *cerror = NULL;
+
+		g_print ("Create for %s:\n", path);
+
+		dirname = g_dirname (path);
+		filename = g_basename (path);
+
+		service = tracker_ontology_get_service_by_name (service_type);
+
+		/* This is BS, it's using the wrong table to create a new ID,
+		 * but appearently that's how to do it ... (this will make
+		 * the decomposed tables out of sync with the old ones) */
+
+		id = tracker_data_update_get_new_service_id (iface);
+
+		g_print ("INSERT INTO \"%s\" (ID, Path, Name) VALUES ('%d', '%s', '%s')\n",
+			 tracker_service_get_name (service), id, 
+			 dirname, filename);
+
+		tracker_db_interface_execute_query (iface, &cerror,
+						    "INSERT INTO \"%s\" (ID, Path, Name) VALUES ('%d', '%s', '%s')",
+						    tracker_service_get_name (service), id, 
+						    dirname, filename);
+
+		if (cerror) {
+			g_print ("CREATE ERROR: %s\n", cerror->message);
+			g_error_free (cerror);
+			return;
+		}
+
+
+		g_hash_table_iter_init (&iter, metadata);
+
+		while (g_hash_table_iter_next (&iter, &hkey, &hvalue)) {
+			TrackerField *field = tracker_ontology_get_field_by_name (hkey);
+			if (field) {
+				TrackerService *service = tracker_field_get_service (field);
+				TrackerDBInterface *ciface;
+
+				ciface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
+										      TRACKER_DB_CONTENT_TYPE_METADATA_DECOMPOSED);
+
+				tracker_db_interface_execute_query (ciface, &cerror,
+								    "UPDATE \"%s\" SET \"%s\" = '%s' WHERE ID = %d",
+								    tracker_service_get_name (service),
+								    (gchar*) hkey, (gchar*) hvalue, id);
+
+				g_print ("UPDATE \"%s\" SET \"%s\" = '%s' WHERE ID = %d\n",
+						tracker_service_get_name (service),
+						(gchar*) hkey, (gchar*) hvalue, id);
+
+				if (cerror) {
+					g_print ("CREATE ERROR: %s\n", cerror->message);
+					g_error_free (cerror);
+				}
+			}
+		}
+		g_print ("END\n");
+	}
+
+}
+
 static void
 create_service_decomposed (TrackerService      *service,
 			   guint32	        id,
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index 3f46989..3b0fbec 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -49,6 +49,9 @@ void             tracker_data_update_move_service               (TrackerService
 							const gchar        *from,
 							const gchar        *to);
 
+void             tracker_data_replace_service                   (const gchar *path,
+							GHashTable *metadata);
+
 /* Metadata */
 void             tracker_data_update_set_metadata               (TrackerService     *service,
 							guint32             id,
diff --git a/src/tracker-indexer/Makefile.am b/src/tracker-indexer/Makefile.am
index f7c8a43..6e568ef 100644
--- a/src/tracker-indexer/Makefile.am
+++ b/src/tracker-indexer/Makefile.am
@@ -13,6 +13,7 @@ INCLUDES =								\
 	-I$(top_srcdir)/src						\
 	$(DBUS_CFLAGS)							\
 	$(PANGO_CFLAGS)							\
+	$(RAPTOR_CFLAGS)						\
 	$(GMODULE_CFLAGS)
 
 libtracker_indexerdir = $(libdir)/tracker
@@ -37,7 +38,9 @@ tracker_indexer_SOURCES =						\
 	tracker-indexer-module.c					\
 	tracker-indexer-module.h					\
 	tracker-main.c							\
-	tracker-marshal-main.c
+	tracker-marshal-main.c						\
+	tracker-turtle.c						\
+	tracker-turtle.h
 
 tracker_indexer_LDADD =							\
 	libtracker-indexer.la						\
@@ -52,6 +55,7 @@ tracker_indexer_LDADD =							\
 	$(PANGO_LIBS)							\
 	$(GIO_LIBS)							\
 	$(GLIB2_LIBS)							\
+	$(RAPTOR_LIBS)							\
 	-lz								\
 	-lm
 
diff --git a/src/tracker-indexer/tracker-indexer.c b/src/tracker-indexer/tracker-indexer.c
index 213b2ee..d37d7d8 100644
--- a/src/tracker-indexer/tracker-indexer.c
+++ b/src/tracker-indexer/tracker-indexer.c
@@ -75,6 +75,7 @@
 #include "tracker-indexer-module.h"
 #include "tracker-marshal.h"
 #include "tracker-module.h"
+#include "tracker-turtle.h"
 
 #define TRACKER_INDEXER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_INDEXER, TrackerIndexerPrivate))
 
@@ -122,6 +123,8 @@ struct TrackerIndexerPrivate {
 	TrackerDBInterface *email_contents;
 	TrackerDBInterface *common;
 	TrackerDBInterface *cache;
+	TrackerDBInterface *email_meta;
+	TrackerDBInterface *file_meta;
 
 	TrackerConfig *config;
 	TrackerLanguage *language;
@@ -242,12 +245,16 @@ start_transaction (TrackerIndexer *indexer)
 
 	indexer->private->in_transaction = TRUE;
 
+//	tracker_db_interface_start_transaction (indexer->private->email_meta);
+//	tracker_db_interface_start_transaction (indexer->private->file_meta);
+
 	tracker_db_interface_start_transaction (indexer->private->cache);
 	tracker_db_interface_start_transaction (indexer->private->file_contents);
 	tracker_db_interface_start_transaction (indexer->private->email_contents);
 	tracker_db_interface_start_transaction (indexer->private->file_metadata);
 	tracker_db_interface_start_transaction (indexer->private->email_metadata);
 	tracker_db_interface_start_transaction (indexer->private->common);
+	
 }
 
 static void
@@ -264,6 +271,9 @@ stop_transaction (TrackerIndexer *indexer)
 	tracker_db_interface_end_transaction (indexer->private->file_contents);
 	tracker_db_interface_end_transaction (indexer->private->cache);
 
+//	tracker_db_interface_start_transaction (indexer->private->file_meta);
+//	tracker_db_interface_start_transaction (indexer->private->email_meta);
+
 	indexer->private->files_indexed += indexer->private->files_processed;
 	indexer->private->files_processed = 0;
 	indexer->private->in_transaction = FALSE;
@@ -853,6 +863,10 @@ tracker_indexer_init (TrackerIndexer *indexer)
 	 * interfaces as singletons, it's safe to just ask it
 	 * again for an interface.
 	 */
+
+	priv->email_meta = tracker_db_manager_get_db_interface (TRACKER_DB_EMAIL_METADATA_DECOMPOSED);
+	priv->file_meta = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_METADATA_DECOMPOSED);
+
 	priv->cache = tracker_db_manager_get_db_interface (TRACKER_DB_CACHE);
 	priv->common = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
 	priv->file_metadata = tracker_db_manager_get_db_interface (TRACKER_DB_FILE_METADATA);
@@ -2401,6 +2415,33 @@ tracker_indexer_process_modules (TrackerIndexer  *indexer,
 	}
 }
 
+// For martyn: this is that { A01 } code
+
+void
+tracker_indexer_turtle_add (TrackerIndexer *indexer,
+			    gchar *file,
+			    DBusGMethodInvocation *context,
+			    GError **error)
+{
+	guint request_id;
+
+	request_id = tracker_dbus_get_next_request_id ();
+
+	tracker_dbus_async_return_if_fail (TRACKER_IS_INDEXER (indexer), context);
+	tracker_dbus_async_return_if_fail (file != NULL, context);
+
+	tracker_dbus_request_new (request_id,
+				  "DBus request to check TTL file %s",
+				  file);
+
+	tracker_turtle_process_ttl (file);
+
+	dbus_g_method_return (context);
+
+	tracker_dbus_request_success (request_id);
+}
+
+
 void
 tracker_indexer_files_check (TrackerIndexer *indexer,
 			     const gchar *module_name,
diff --git a/src/tracker-indexer/tracker-indexer.h b/src/tracker-indexer/tracker-indexer.h
index 8401607..1781a64 100644
--- a/src/tracker-indexer/tracker-indexer.h
+++ b/src/tracker-indexer/tracker-indexer.h
@@ -92,6 +92,10 @@ void		tracker_indexer_pause_for_duration (TrackerIndexer	   *indexer,
 void		tracker_indexer_continue	   (TrackerIndexer	   *indexer,
 						    DBusGMethodInvocation  *context,
 						    GError		  **error);
+void		tracker_indexer_turtle_add	   (TrackerIndexer *indexer,
+						    gchar *file,
+						    DBusGMethodInvocation *context,
+						    GError **error);
 void		tracker_indexer_files_check	   (TrackerIndexer	   *indexer,
 						    const gchar		   *module,
 						    GStrv		    files,
diff --git a/src/tracker-indexer/tracker-turtle.c b/src/tracker-indexer/tracker-turtle.c
new file mode 100644
index 0000000..b8e2930
--- /dev/null
+++ b/src/tracker-indexer/tracker-turtle.c
@@ -0,0 +1,214 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006, Mr Jamie McCracken ([EMAIL PROTECTED])
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ * Author: Philip Van Hoof <[EMAIL PROTECTED]>
+ */
+
+#include "config.h"
+
+#ifdef HAVE_RAPTOR
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/statvfs.h>
+
+#include <glib/gstdio.h>
+#include <gio/gio.h>
+#include <gmodule.h>
+
+#include <raptor.h>
+
+#include <libtracker-common/tracker-config.h>
+#include <libtracker-common/tracker-dbus.h>
+#include <libtracker-common/tracker-file-utils.h>
+#include <libtracker-common/tracker-hal.h>
+#include <libtracker-common/tracker-language.h>
+#include <libtracker-common/tracker-parser.h>
+#include <libtracker-common/tracker-ontology.h>
+#include <libtracker-common/tracker-module-config.h>
+#include <libtracker-common/tracker-utils.h>
+
+#include <libtracker-db/tracker-db-manager.h>
+#include <libtracker-db/tracker-db-index-manager.h>
+#include <libtracker-db/tracker-db-interface-sqlite.h>
+
+#include <libtracker-data/tracker-data-query.h>
+#include <libtracker-data/tracker-data-update.h>
+
+#include "tracker-turtle.h"
+
+typedef struct {
+	gchar *last_subject;
+	GHashTable *metadata;
+	gchar *base;
+} TurtleParseInfo;
+
+static void
+commit_turtle_parse_info_data (TurtleParseInfo *info)
+{
+	if (info->last_subject) {
+
+		/* We have it as a URI, database api wants Paths. Update this when
+		 * the database api becomes sane and uses URIs everywhere */
+		tracker_data_replace_service (info->last_subject + 7, info->metadata);
+
+		g_hash_table_destroy (info->metadata);
+		g_free (info->last_subject);
+		info->last_subject = NULL;
+		info->metadata = NULL;
+	}
+
+	/* We should commit per transaction of 50 here, and sometimes iterate
+	 * the mainloop (when the transaction was just committed each #50th) */
+
+	g_main_context_iteration (NULL, FALSE);
+}
+
+static void
+consume_triple (void* user_data, const raptor_statement* triple) 
+{
+	TurtleParseInfo *info = user_data;
+	gchar *subject;
+
+	subject = (gchar *) raptor_uri_as_string ((raptor_uri *) triple->subject);
+
+	if (!info->last_subject || strcmp (subject, info->last_subject) != 0) {
+
+		/* Commit previous subject */
+
+		commit_turtle_parse_info_data (info);
+
+		info->last_subject = g_strdup (subject);
+
+		info->metadata = g_hash_table_new_full (g_str_hash, g_str_equal,
+							(GDestroyNotify) g_free,
+							(GDestroyNotify) g_free);
+	}
+
+	if (triple->object_type == RAPTOR_IDENTIFIER_TYPE_LITERAL) {
+		gchar *predicate;
+
+		predicate = g_strdup ((const gchar *) raptor_uri_as_string ((raptor_uri *) triple->predicate));
+
+		g_hash_table_replace (info->metadata, 
+				      g_strdup (predicate),
+				      /* g_ascii_strup (predicate, -1),  */
+				      g_strdup (triple->object));
+
+	} else if (triple->object_type == RAPTOR_IDENTIFIER_TYPE_RESOURCE) {
+		gchar *key = g_strdup_printf ("file://%s/:", info->base);
+
+		if (strcmp (key, triple->object) == 0) {
+			gchar *predicate;
+
+			predicate = (gchar *) raptor_uri_as_string ((raptor_uri *) triple->predicate);
+
+			g_hash_table_replace (info->metadata, 
+					      g_strdup (predicate), 
+					      /* g_ascii_strup (predicate, -1), */
+					      g_strdup (""));
+
+			/* g_hash_table_remove (info->metadata, predicate); */
+		}
+
+		g_free (key);
+	}
+
+}
+
+static void 
+raptor_error (void *user_data, raptor_locator* locator, const char *message)
+{
+	g_print ("RAPTOR_ERROR: %s\n", message);
+}
+
+#endif /* HAVE_RAPTOR */
+
+void
+tracker_turtle_process_ttl (const gchar *file)
+{
+#ifdef HAVE_RAPTOR
+
+	unsigned char *uri_stringa, *uri_stringb;
+	raptor_uri *uri, *base_uri;
+	static gboolean has_init = FALSE;
+	raptor_parser *parser;
+	TurtleParseInfo *info;
+	gchar *copy_file, *ptr;
+
+	if (!has_init)
+		raptor_init();
+
+	parser = raptor_new_parser ("turtle");
+
+	info = g_slice_new0 (TurtleParseInfo);
+
+	raptor_set_statement_handler (parser, info, consume_triple);
+	raptor_set_fatal_error_handler (parser, info, raptor_error);
+	raptor_set_error_handler (parser, info, raptor_error);
+	raptor_set_warning_handler (parser, info, raptor_error);
+
+	copy_file = g_strdup (file);
+
+	ptr = strstr (copy_file, "/metadata/metadata.ttl");
+	if (ptr) {
+		/* .cache remains, and will be cut later, just like dummy_file is */
+		*ptr = '\0';
+	} else {
+		g_free (copy_file);
+		copy_file = g_strdup ("/home/pvanhoof/dummy_file");
+	}
+
+
+	uri_stringa = raptor_uri_filename_to_uri_string (file);
+	uri_stringb = raptor_uri_filename_to_uri_string (copy_file);
+
+	uri = raptor_new_uri (uri_stringa);
+	base_uri = raptor_new_uri (uri_stringb);
+
+	/* Take the file (dummy_file or .cache) from base */
+	ptr = strrchr (copy_file, '/');
+	if (ptr)
+		*ptr = '\0';
+
+	info->base = copy_file;
+
+	raptor_parse_file (parser, uri, base_uri);
+
+	/* Commit final subject */
+
+	commit_turtle_parse_info_data (info);
+
+	g_free (copy_file);
+	g_slice_free (TurtleParseInfo, info);
+
+	raptor_free_parser (parser);
+
+	raptor_free_uri (base_uri);
+	raptor_free_uri (uri);
+	raptor_free_memory (uri_stringa);
+	raptor_free_memory (uri_stringb);
+
+	/* raptor_finish(); */
+
+#endif /* HAVE_RAPTOR */
+
+}
+
diff --git a/src/tracker-indexer/tracker-turtle.h b/src/tracker-indexer/tracker-turtle.h
new file mode 100644
index 0000000..f0ee975
--- /dev/null
+++ b/src/tracker-indexer/tracker-turtle.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006, Mr Jamie McCracken ([EMAIL PROTECTED])
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ * Author: Philip Van Hoof <[EMAIL PROTECTED]>
+ */
+
+#ifndef __TRACKER_TURTLE_H__
+#define __TRACKER_TURTLE_H__
+
+void    tracker_turtle_process_ttl   (const gchar *file);
+
+#endif /* __TRACKER_TURTLE_H__ */
diff --git a/src/trackerd/tracker-processor.c b/src/trackerd/tracker-processor.c
index e95ffa9..3eb8bb9 100644
--- a/src/trackerd/tracker-processor.c
+++ b/src/trackerd/tracker-processor.c
@@ -1390,11 +1390,26 @@ mount_point_added_cb (TrackerHal  *hal,
 {
 	TrackerProcessor *processor;
 	TrackerStatus	  status;
+	gchar *metadata_file;
 
 	processor = user_data;
 
 	g_message ("** TRAWLING THROUGH NEW MOUNT POINT:'%s'", mount_point);
 
+	metadata_file = g_build_filename (mount_point, ".cache", 
+					  "metadata", 
+					  "metadata.ttl", NULL);
+
+	if (g_file_test (metadata_file, G_FILE_TEST_EXISTS)) {
+		g_message ("** FOUND TURTLE FILE:'%s'", metadata_file);
+
+		// Process a TTL file
+		// This is where the code in the DBus API handler 
+		// tracker_indexer_turtle_add must come { A01 }
+	}
+
+	g_free (metadata_file);
+
 	status = tracker_status_get ();
 
 	processor->private->iterated_removable_media = FALSE;
diff --git a/tests/tracker-indexer/Makefile.am b/tests/tracker-indexer/Makefile.am
index 00b9cfb..76ed0d9 100644
--- a/tests/tracker-indexer/Makefile.am
+++ b/tests/tracker-indexer/Makefile.am
@@ -17,6 +17,7 @@ INCLUDES = 								\
 	$(DBUS_CFLAGS)							\
 	$(PANGO_CFLAGS)							\
 	$(GMODULE_CFLAGS)						\
+	$(RAPTOR_CFLAGS)						\
 	$(GTHREAD_CFLAGS)						\
 	$(GLIB2_CFLAGS)
 
@@ -31,7 +32,9 @@ tracker_metadata_utils_SOURCES = 					\
 	tracker-metadata-utils.c 					\
 	tracker-metadata-utils.h 					\
 	tracker-metadata-utils-test.c 					\
-	tracker-module.h
+	tracker-module.h						\
+	tracker-turtle.c						\
+	tracker-turtle.h
 
 tracker_metadata_utils_LDADD =	                                        \
 	$(top_builddir)/src/libtracker-data/libtracker-data.la 		\
@@ -43,6 +46,7 @@ tracker_metadata_utils_LDADD =	                                        \
 	$(GMODULE_LIBS)							\
 	$(GTHREAD_LIBS)							\
 	$(GIO_LIBS)							\
+	$(RAPTOR_LIBS)							
 	$(GLIB2_LIBS)							
 
 #
_______________________________________________
tracker-list mailing list
tracker-list@gnome.org
http://mail.gnome.org/mailman/listinfo/tracker-list

Reply via email to