[tracker/tracker-0.10] tracker-writeback: Do not touch unsupported files



commit ac4962c3e79b2d6408099aff8b758faaf74e2bc0
Author: JÃrg Billeter <j bitron ch>
Date:   Tue Jul 26 16:14:24 2011 +0200

    tracker-writeback: Do not touch unsupported files
    
    Fixes NB#274498.

 src/tracker-writeback/tracker-writeback-file.c |   32 +++++++++++++----------
 1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-file.c b/src/tracker-writeback/tracker-writeback-file.c
index 3ada83f..e686de6 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -159,14 +159,6 @@ tracker_writeback_file_update_metadata (TrackerWriteback        *writeback,
 		return FALSE;
 	}
 
-	/* Copy to a temporary file so we can perform an atomic write on move */
-	tmp_file = create_temporary_file (file, file_info);
-
-	if (!tmp_file) {
-		g_object_unref (file);
-		return FALSE;
-	}
-
 	mime_type = g_file_info_get_content_type (file_info);
 	content_types = (writeback_file_class->content_types) (TRACKER_WRITEBACK_FILE (writeback));
 
@@ -181,14 +173,26 @@ tracker_writeback_file_update_metadata (TrackerWriteback        *writeback,
 
 	g_object_unref (file_info);
 
-	if (retval) {
-		retval = (writeback_file_class->update_file_metadata) (TRACKER_WRITEBACK_FILE (writeback),
-		                                                       tmp_file,
-		                                                       values,
-		                                                       connection,
-		                                                       cancellable);
+	if (!retval) {
+		/* module does not support writeback for this file */
+		g_object_unref (file);
+		return FALSE;
 	}
 
+	/* Copy to a temporary file so we can perform an atomic write on move */
+	tmp_file = create_temporary_file (file, file_info);
+
+	if (!tmp_file) {
+		g_object_unref (file);
+		return FALSE;
+	}
+
+	retval = (writeback_file_class->update_file_metadata) (TRACKER_WRITEBACK_FILE (writeback),
+	                                                       tmp_file,
+	                                                       values,
+	                                                       connection,
+	                                                       cancellable);
+
 	/* Move back the modified file to the original location */
 	g_file_move (tmp_file, file,
 	             G_FILE_COPY_OVERWRITE,



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