tracker r2418 - trunk/src/tracker-indexer



Author: pvanhoof
Date: Thu Oct 23 15:01:10 2008
New Revision: 2418
URL: http://svn.gnome.org/viewvc/tracker?rev=2418&view=rev

Log:
2008-10-23  Philip Van Hoof  <philip codeminded be>

        * src/tracker-indexer/tracker-metadata-utils.c
        * src/tracker-indexer/tracker-dbus.c
        * src/tracker-indexer/tracker-dbus.h: Fixes for requesting thumbnails



Modified:
   trunk/src/tracker-indexer/tracker-metadata-utils.c

Modified: trunk/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-metadata-utils.c	(original)
+++ trunk/src/tracker-indexer/tracker-metadata-utils.c	Thu Oct 23 15:01:10 2008
@@ -665,20 +665,54 @@
 	return retval;
 }
 
+/* It's known that these 51 * 2 lists of strings are leaked at least
+ * once at the end of the process. */
+
+static gchar   *batch[51];
+static gchar   *hints[51];
+static guint    count = 0;
+static gboolean timeout_runs = FALSE;
+
+static gboolean
+request_thumbnails (gpointer data)
+{
+	if (timeout_runs) {
+		guint i;
+
+		timeout_runs = FALSE;
+		batch[count] = NULL;
+		hints[count] = NULL;
+
+		g_debug ("Requesting thumbnails");
+
+		dbus_g_proxy_begin_call (tracker_dbus_get_thumbnailer (),
+					 "Queue",
+					 get_file_thumbnail_queue_cb,
+					 NULL, NULL,
+					 G_TYPE_STRV, batch,
+					 G_TYPE_STRV, hints,
+					 G_TYPE_UINT, 0,
+					 G_TYPE_INVALID);
+
+		for (i = 0; i <= count; i++) {
+			g_free (batch[i]);
+			g_free (hints[i]);
+		}
+
+		count = 0;
+	}
+
+	return FALSE;
+}
+
 static void
 get_file_thumbnail (const gchar *path,
 		    const gchar *mime)
 {
 #ifdef HAVE_HILDON_THUMBNAIL
 
-	static guint    count = 0;
 	static gboolean tried = FALSE;
 
-	/* It's known that these 51 * 2 lists of strings are leaked at least
-	 * once at the end of the process. */
-
-	static gchar   *batch[51];
-	static gchar   *hints[51];
 
 	/* It's known that this relatively small GStrv is leaked */
 	static GStrv    thumbnailable = NULL;
@@ -711,32 +745,17 @@
 			g_free (utf_path);
 			count++;
 		}
-	}
-
-	if (count == 51) {
-		guint i;
-
-		batch[51] = NULL;
-		hints[51] = NULL;
 
-		g_debug ("Requesting thumbnails");
-
-		dbus_g_proxy_begin_call (tracker_dbus_get_thumbnailer (),
-					 "Queue",
-					 get_file_thumbnail_queue_cb,
-					 NULL, NULL,
-					 G_TYPE_STRV, batch,
-					 G_TYPE_STRV, hints,
-					 G_TYPE_UINT, 0,
-					 G_TYPE_INVALID);
-
-		for (i = 0; i <= count; i++) {
-			g_free (batch[i]);
-			g_free (hints[i]);
+		if (!timeout_runs) {
+			timeout_runs = TRUE;
+			g_timeout_add_seconds (30, request_thumbnails, NULL);
 		}
+	}
 
-		count = 0;
+	if (count == 51) {
+		request_thumbnails (NULL);
 	}
+
 #else /* HAVE_HILDON_THUMBNAIL */
 	ProcessContext *context;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]