[shotwell] Improved logging in MetadataWriter



commit a339a68ed240689736861d554d37d52ba5920d7f
Author: Jim Nelson <jim yorba org>
Date:   Thu Sep 25 17:39:04 2014 -0700

    Improved logging in MetadataWriter

 src/MetadataWriter.vala |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/MetadataWriter.vala b/src/MetadataWriter.vala
index aee5855..9f2d56b 100644
--- a/src/MetadataWriter.vala
+++ b/src/MetadataWriter.vala
@@ -23,6 +23,8 @@ public class MetadataWriter : Object {
         public Photo.ReimportMasterState reimport_master_state = null;
         public Photo.ReimportEditableState reimport_editable_state = null;
         public Error? err = null;
+        public bool wrote_master = false;
+        public bool wrote_editable = false;
         
         public CommitJob(MetadataWriter owner, LibraryPhoto photo, Gee.Set<string>? keywords) {
             base (owner, owner.on_update_completed, new Cancellable(), owner.on_update_cancelled);
@@ -58,6 +60,8 @@ public class MetadataWriter : Object {
                     LibraryMonitor.unblacklist_file(photo.get_master_file());
                 }
             }
+            
+            wrote_master = true;
         }
         
         private void commit_editable() throws Error {
@@ -75,6 +79,8 @@ public class MetadataWriter : Object {
                     LibraryMonitor.unblacklist_file(photo.get_editable_file());
                 }
             }
+            
+            wrote_editable = true;
         }
         
         private bool update_metadata(PhotoMetadata metadata, bool skip_orientation = false) {
@@ -617,10 +623,21 @@ public class MetadataWriter : Object {
     private void on_update_completed(BackgroundJob j) {
         CommitJob job = (CommitJob) j;
         
-        if (job.err != null)
-            warning("Unable to update metadata for %s: %s", job.photo.to_string(), job.err.message);
-        else
-            message("Completed writing metadata for %s", job.photo.to_string());
+        if (job.err != null) {
+            warning("Unable to write metadata to %s: %s", job.photo.to_string(), job.err.message);
+        } else {
+            if (job.wrote_master)
+                message("Completed writing metadata to %s", job.photo.get_master_file().get_path());
+            else
+                message("Unable to write metadata to %s", job.photo.get_master_file().get_path());
+            
+            if (job.photo.get_editable_file() != null) {
+                if (job.wrote_editable)
+                    message("Completed writing metadata to %s", job.photo.get_editable_file().get_path());
+                else
+                    message("Unable to write metadata to %s", job.photo.get_editable_file().get_path());
+            }
+        }
         
         bool removed = pending.unset(job.photo);
         assert(removed);


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