Re: [Tracker] Merge Turtle branch to Trunk, the diff

2008-12-01 Thread Philip Van Hoof
Hi there reviewers,

Some new changes by me and Ivan have happened to the Turtle branch
today, but whoever wants to review can review this patch already, I'll
make a new patch with the extra/new changes soonish (they are small
enough that I can adapt the code to the comments of the reviewer).

On Mon, 2008-12-01 at 12:05 +0100, Philip Van Hoof wrote:
> This is a new version of the same patch. In this version I don't do the
> memory-leak fix in tracker_data_metadata_insert_values as this fix was
> conflicting with how tracker_data_metadata_insert_values is being used
> in result_set_to_metadata
> 

-- 
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

___
tracker-list mailing list
tracker-list@gnome.org
http://mail.gnome.org/mailman/listinfo/tracker-list


Re: [Tracker] Merge Turtle branch to Trunk, the diff

2008-12-01 Thread Philip Van Hoof
This is a new version of the same patch. In this version I don't do the
memory-leak fix in tracker_data_metadata_insert_values as this fix was
conflicting with how tracker_data_metadata_insert_values is being used
in result_set_to_metadata

-- 
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
Index: src/tracker-indexer/tracker-main.c
===
--- src/tracker-indexer/tracker-main.c	(revision 2615)
+++ src/tracker-indexer/tracker-main.c	(working copy)
@@ -43,6 +43,7 @@
 #include 
 
 #include 
+#include 
 
 #include "tracker-dbus.h"
 #include "tracker-indexer.h"
@@ -370,13 +371,18 @@
 tracker_indexer_process_modules (indexer, modules);
 }
 
+	tracker_turtle_init ();
+
 	g_message ("Starting...");
 
+
 	main_loop = g_main_loop_new (NULL, FALSE);
 	g_main_loop_run (main_loop);
 
 	g_message ("Shutdown started");
 
+	tracker_turtle_shutdown ();
+
 	if (quit_timeout_id) {
 		g_source_remove (quit_timeout_id);
 	}
Index: src/tracker-indexer/tracker-indexer.c
===
--- src/tracker-indexer/tracker-indexer.c	(revision 2615)
+++ src/tracker-indexer/tracker-indexer.c	(working copy)
@@ -75,6 +75,7 @@
 #include "tracker-indexer.h"
 #include "tracker-indexer-module.h"
 #include "tracker-marshal.h"
+#include "tracker-removable-device.h"
 
 #define TRACKER_INDEXER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_INDEXER, TrackerIndexerPrivate))
 
@@ -84,9 +85,6 @@
 #define LOW_DISK_CHECK_FREQUENCY10
 #define SIGNAL_STATUS_FREQUENCY 10
 
-/* Transaction every 'x' items */
-#define TRANSACTION_MAX		2000
-
 /* Throttle defaults */
 #define THROTTLE_DEFAULT	0
 #define THROTTLE_DEFAULT_ON_BATTERY 5
@@ -384,6 +382,22 @@
 			indexer);
 }
 
+
+void 
+tracker_indexer_commit_transaction (TrackerIndexer *indexer)
+{
+	stop_transaction (indexer);
+	tracker_indexer_set_running (indexer, TRUE);
+
+}
+
+void
+tracker_indexer_open_transaction   (TrackerIndexer *indexer)
+{
+	tracker_indexer_set_running (indexer, FALSE);
+	start_transaction (indexer);
+}
+
 #ifdef HAVE_HAL
 
 static void
@@ -1355,6 +1369,8 @@
 	TrackerService *service;
 	gchar *text;
 	guint32 id;
+	gchar *mount_point = NULL;
+	gchar *service_path;
 
 	service = get_service_for_file (info->module_file, info->module);
 
@@ -1392,6 +1408,28 @@
 
 		index_metadata (indexer, id, service, metadata);
 
+		/* TODO: URI branch path -> uri */
+
+		service_path = g_build_path (G_DIR_SEPARATOR_S, 
+	 dirname, 
+	 basename, 
+	 NULL);
+
+		if (tracker_hal_path_is_on_removable_device (indexer->private->hal,
+			 service_path, 
+			 &mount_point,
+			 NULL)) {
+
+			tracker_removable_device_add_metadata (indexer, 
+			   mount_point, 
+			   service_path, 
+			   metadata);
+		}
+
+		g_free (mount_point);
+		mount_point = NULL;
+		g_free (service_path);
+
 		/* Take the old text -> the new one, calculate
 		 * difference and add the words.
 		 */
@@ -1425,6 +1463,28 @@
 
 	index_metadata (indexer, id, service, metadata);
 
+	/* TODO: URI branch path -> uri */
+
+	service_path = g_build_path (G_DIR_SEPARATOR_S, 
+ dirname, 
+ basename, 
+ NULL);
+
+	if (tracker_hal_path_is_on_removable_device (indexer->private->hal,
+		 service_path, 
+		 &mount_point,
+		 NULL)) {
+
+		tracker_removable_device_add_metadata (indexer, 
+		   mount_point, 
+		   service_path,
+		   metadata);
+	}
+
+	g_free (mount_point);
+	mount_point = NULL;
+	g_free (service_path);
+
 	text = tracker_module_file_get_text (info->module_file);
 
 	if (text) {
@@ -1465,6 +1525,7 @@
 	GFile *file, *other_file;
 	gchar *path, *other_path;
 	gchar *uri, *other_uri, *mime_type;
+	gchar *mount_point = NULL;
 	guint32 id;
 
 	service = get_service_for_file (info->other_module_file, info->module);
@@ -1506,6 +1567,27 @@
 
 	tracker_data_update_move_service (service, path, other_path);
 
+	if (tracker_hal_path_is_on_removable_device (indexer->private->hal,
+		 path, 
+		 &mount_point,
+		 NULL) &&
+	tracker_hal_path_is_on_removable_device (indexer->private->hal,
+		 other_path, 
+		 NULL,
+		 NULL) ) {
+
+		tracker_removable_device_add_move (indexer, 
+		   mount_point, 
+		   path, 
+		   other_path);
+	} else {
+		tracker_removable_device_add_removal (indexer, 
+		  mount_point, 
+		  path);
+	}
+
+	g_free (mount_point);
+
 	/*
 	 *  Updating what changes in move event (Path related properties)
 	 */
@@ -1557,6 +1639,7 @@
 	gchar *service_path;
 	const gchar *service_type;
 	guint service_id, service_type_id;
+	gchar *mount_point = NULL;
 
 	service_type = tracker_module_config_get_index_service (info->module->name);
 
@@ -1651