tracker r3059 - in trunk: . src/tracker-indexer



Author: carlosg
Date: Thu Mar 12 12:17:56 2009
New Revision: 3059
URL: http://svn.gnome.org/viewvc/tracker?rev=3059&view=rev

Log:
2009-03-12  Carlos Garnacho  <carlos imendio com>

        * src/tracker-indexer/tracker-indexer.c (generate_item_thumbnail)
        (item_add_or_update): Generate thumbnails here, so we can access
        configuration and actually respect the EnableThumbnails option. Fixes
        #503595.
        * src/tracker-indexer/tracker-module-metadata-utils.c
        (tracker_module_metadata_utils_get_data): Remove thumbnail generation
        from here.

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

Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c	(original)
+++ trunk/src/tracker-indexer/tracker-indexer.c	Thu Mar 12 12:17:56 2009
@@ -100,6 +100,7 @@
 #define METADATA_FILE_EXT	     "File:Ext"
 #define METADATA_FILE_PATH	     "File:Path"
 #define METADATA_FILE_NAME	     "File:Name"
+#define METADATA_FILE_MIMETYPE       "File:Mime"
 
 typedef struct PathInfo PathInfo;
 typedef struct MetadataForeachData MetadataForeachData;
@@ -1448,6 +1449,32 @@
 }
 
 static void
+generate_item_thumbnail (TrackerIndexer        *indexer,
+			 const gchar           *dirname,
+			 const gchar           *basename,
+			 TrackerModuleMetadata *metadata)
+{
+	const gchar *path, *mime_type;
+
+	path = tracker_module_metadata_lookup (metadata, METADATA_FILE_NAME_DELIMITED, FALSE);
+	mime_type = tracker_module_metadata_lookup (metadata, METADATA_FILE_MIMETYPE, FALSE);
+
+	if (path && path[0] == G_DIR_SEPARATOR && mime_type &&
+	    tracker_config_get_enable_thumbnails (indexer->private->config)) {
+		GFile *file;
+		gchar *uri;
+
+		file = g_file_new_for_path (path);
+		uri = g_file_get_uri (file);
+
+		tracker_thumbnailer_get_file_thumbnail (uri, mime_type);
+
+		g_object_unref (file);
+		g_free (uri);
+	}
+}
+
+static void
 item_add_or_update (TrackerIndexer        *indexer,
 		    PathInfo              *info,
 		    const gchar           *dirname,
@@ -1566,6 +1593,8 @@
 		g_hash_table_destroy (data);
 	}
 
+	generate_item_thumbnail (indexer, dirname, basename, metadata);
+
 	/* TODO: URI branch path -> uri */
 
 	service_path = g_build_path (G_DIR_SEPARATOR_S, 
@@ -1587,7 +1616,6 @@
 
 	g_free (mount_point);
 	g_free (service_path);
-
 }
 
 

Modified: trunk/src/tracker-indexer/tracker-module-metadata-utils.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-module-metadata-utils.c	(original)
+++ trunk/src/tracker-indexer/tracker-module-metadata-utils.c	Thu Mar 12 12:17:56 2009
@@ -715,14 +715,6 @@
 	g_free (basename);
 	g_free (dirname);
 
-	if (mime_type) {
-		gchar *uri;
-
-		uri = g_file_get_uri (file);
-		tracker_thumbnailer_get_file_thumbnail (uri, mime_type);
-		g_free (uri);
-	}
-
 	if (S_ISLNK (st.st_mode)) {
 		gchar *link_path;
 		gchar *link_path_delimited;



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