Index: src/tracker-indexer/tracker-metadata-utils.c
===================================================================
--- src/tracker-indexer/tracker-metadata-utils.c	(revision 2237)
+++ src/tracker-indexer/tracker-metadata-utils.c	(working copy)
@@ -25,12 +25,6 @@
 
 #include <gio/gio.h>
 
-#define THUMBNAIL_RETRIEVAL_ENABLED
-
-#ifdef HAVE_HILDON_THUMBNAIL
-#include <hildon-thumbnail-factory.h>
-#endif
-
 #include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-common/tracker-type-utils.h>
 #include <libtracker-common/tracker-os-dependant.h>
@@ -38,6 +32,10 @@
 
 #include "tracker-metadata-utils.h"
 
+#ifndef TEST
+#include "tracker-dbus.h"
+#endif
+
 #define METADATA_FILE_NAME_DELIMITED "File:NameDelimited"
 #define METADATA_FILE_EXT            "File:Ext"
 #define METADATA_FILE_PATH           "File:Path"
@@ -614,53 +612,62 @@
         return s ? g_string_free (s, FALSE) : NULL;
 }
 
+#ifndef TEST
 static void
-get_file_thumbnail (const gchar *path,
-		    const gchar *mime)
+have_thumbnail (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
 {
-#ifdef THUMBNAIL_RETRIEVAL_ENABLED
-#ifdef HAVE_HILDON_THUMBNAIL
-	hildon_thumbnail_factory_load (path, mime, 128, 128, NULL, NULL);
-#else
-	ProcessContext *context;
+	GError *error = NULL;
+	guint   OUT_handle;
 
-	GString *thumbnail;
-	gchar *argv[5];
+	dbus_g_proxy_end_call (proxy, call, &error, 
+			       G_TYPE_UINT, &OUT_handle, 
+			       G_TYPE_INVALID);
 
-	argv[0] = g_strdup (LIBEXEC_PATH G_DIR_SEPARATOR_S "tracker-thumbnailer");
-	argv[1] = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
-	argv[2] = g_strdup (mime);
-	argv[3] = g_strdup ("normal");
-	argv[4] = NULL;
+}
+#endif
 
-	context = process_context_create ((const gchar **) argv, get_file_content_read_cb);
+static void
+get_file_thumbnail (const gchar *path,
+		    const gchar *mime)
+{
+#ifndef TEST
+	static gchar   *batch[51];
+	static guint    count = 0;
+	static gboolean not_available = FALSE;
 
-	if (!context) {
+	if (not_available)
 		return;
+
+	if (count < 51) {
+		batch[count++] = g_strdup (path);
 	}
 
-	thumbnail = g_string_new (NULL);
-	context->data = thumbnail;
+	if (count == 51) {
+		guint       i;
+		GError     *error = NULL;
+		DBusGProxy *proxy = tracker_dbus_get_thumbnailer ();
 
-	g_main_loop_run (context->data_incoming_loop);
+		batch[51] = NULL;
 
-	g_free (argv[0]);
-	g_free (argv[1]);
-	g_free (argv[2]);
-	g_free (argv[3]);
+		dbus_g_proxy_begin_call (proxy, "Queue", 
+					 have_thumbnail, 
+					 NULL, NULL, 
+					 G_TYPE_STRV, batch, 
+					 G_TYPE_UINT, 0, 
+					 G_TYPE_INVALID);
 
-	process_context_destroy (context);
 
-	if (!thumbnail->str || !*thumbnail->str) {
-		g_string_free (thumbnail, TRUE);
-		return;
-	}
+		if (error) {
+			not_available = TRUE;
+			g_error_free (error);
+		}
 
-	g_debug ("Got thumbnail '%s' for '%s'", thumbnail->str, path);
+		for (i = 0; i < count; i++)
+			g_free (batch[i]);
 
-	g_string_free (thumbnail, TRUE);
-#endif /* HAVE_HILDON_THUMBNAIL */
-#endif /* THUMBNIAL_RETRIEVAL_ENABLED */
+		count = 0;
+	}
+#endif
 }
 
 static gchar *

