Commit 66473d95 authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Carlos Garnacho

Generate thumbnails here, so we can access configuration and actually

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.

svn path=/trunk/; revision=3059
parent d70dc9d2
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.
2009-03-12 Philip Van Hoof <philip@codeminded.be>
* src/tracker-indexer/tracker-removable-device.c: Fixed a crash when
......
......@@ -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;
......@@ -1447,6 +1448,32 @@ remove_stale_children (TrackerIndexer *indexer,
g_strfreev (children);
}
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,
......@@ -1566,6 +1593,8 @@ item_add_or_update (TrackerIndexer *indexer,
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 @@ item_add_or_update (TrackerIndexer *indexer,
g_free (mount_point);
g_free (service_path);
}
......
......@@ -715,14 +715,6 @@ tracker_module_metadata_utils_get_data (GFile *file)
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment