[tracker] tracker-writeback: Don't just process the first row of results for file writebacks
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-writeback: Don't just process the first row of results for file writebacks
- Date: Mon, 16 Aug 2010 11:40:26 +0000 (UTC)
commit 58d53b357226963f1388a5e7cadf756bf7ac514b
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Aug 16 13:36:40 2010 +0200
tracker-writeback: Don't just process the first row of results for file writebacks
src/tracker-writeback/tracker-writeback-file.c | 75 ++++++++++++------------
1 files changed, 38 insertions(+), 37 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-file.c b/src/tracker-writeback/tracker-writeback-file.c
index 1b05476..c234e5f 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -72,7 +72,7 @@ tracker_writeback_file_update_metadata (TrackerWriteback *writeback,
GStrv row;
const gchar * const *content_types;
const gchar *mime_type;
- guint n;
+ guint n, x;
writeback_file_class = TRACKER_WRITEBACK_FILE_GET_CLASS (writeback);
@@ -88,55 +88,56 @@ tracker_writeback_file_update_metadata (TrackerWriteback *writeback,
return FALSE;
}
- /* Get the file from the first row */
- row = g_ptr_array_index (values, 0);
- file = g_file_new_for_uri (row[0]);
-
- file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL, NULL);
-
- if (!file_info) {
- if (file) {
- g_object_unref (file);
+ for (x = 0 ; x < values->len ; x++) {
+ /* Get the file from the row */
+ row = g_ptr_array_index (values, x);
+ file = g_file_new_for_uri (row[0]);
+
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL, NULL);
+
+ if (!file_info) {
+ if (file) {
+ g_object_unref (file);
+ }
+ continue;
}
- return FALSE;
- }
-
- mime_type = g_file_info_get_content_type (file_info);
- content_types = (writeback_file_class->content_types) (TRACKER_WRITEBACK_FILE (writeback));
+ mime_type = g_file_info_get_content_type (file_info);
+ content_types = (writeback_file_class->content_types) (TRACKER_WRITEBACK_FILE (writeback));
- retval = FALSE;
+ retval = FALSE;
- for (n = 0; content_types[n] != NULL; n++) {
- if (g_strcmp0 (mime_type, content_types[n]) == 0) {
- retval = TRUE;
- break;
+ for (n = 0; content_types[n] != NULL; n++) {
+ if (g_strcmp0 (mime_type, content_types[n]) == 0) {
+ retval = TRUE;
+ break;
+ }
}
- }
- g_object_unref (file_info);
+ g_object_unref (file_info);
- if (retval) {
- g_message ("Locking file '%s' in order to write metadata", row[0]);
+ if (retval) {
+ g_message ("Locking file '%s' in order to write metadata", row[0]);
- tracker_file_lock (file);
+ tracker_file_lock (file);
- urls[0] = row[0];
+ urls[0] = row[0];
- tracker_miner_manager_ignore_next_update (tracker_writeback_get_miner_manager (),
- "org.freedesktop.Tracker1.Miner.Files",
- urls);
+ tracker_miner_manager_ignore_next_update (tracker_writeback_get_miner_manager (),
+ "org.freedesktop.Tracker1.Miner.Files",
+ urls);
- retval = (writeback_file_class->update_file_metadata) (TRACKER_WRITEBACK_FILE (writeback),
- file, values, client);
+ retval = (writeback_file_class->update_file_metadata) (TRACKER_WRITEBACK_FILE (writeback),
+ file, values, client);
- g_timeout_add_seconds (3, file_unlock_cb, g_object_ref (file));
- }
+ g_timeout_add_seconds (3, file_unlock_cb, g_object_ref (file));
+ }
- g_object_unref (file);
+ g_object_unref (file);
+ }
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]