[shotwell] Keep RAW+JPEG association from CameraImport



commit 67b4d6ed0fba2f2cc891915d1afb84e8bd17acdf
Author: Jens Georg <mail jensge org>
Date:   Sat Aug 19 10:29:30 2017 +0200

    Keep RAW+JPEG association from CameraImport
    
    CameraImportJob will copy RAW and JPEG, pass only the raws down to the
    batch importer.
    
    The batch importer then won't know about the associated file, and
    extract the embedded file (or worse, make a development) of the RAW
    file, schedule thumbnailing for that.
    
    In the conclude step of the CameraImportJob, the files would be
    associated, leading to the development being thrown away and run another
    thumbnailing job.

 src/BatchImport.vala       |   10 ++++++++++
 src/camera/ImportPage.vala |   19 ++++++-------------
 2 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/src/BatchImport.vala b/src/BatchImport.vala
index 116e001..bd15b94 100644
--- a/src/BatchImport.vala
+++ b/src/BatchImport.vala
@@ -171,6 +171,10 @@ public abstract class BatchImportJob {
     public virtual DuplicatedFile? get_duplicated_file() {
         return null;
     }
+
+    public virtual File? get_associated_file() {
+        return null;
+    }
     
     // Attaches a sibling job (for RAW+JPEG)
     public abstract void set_associated(BatchImportJob associated);
@@ -1974,6 +1978,12 @@ private class PreparedFileImportJob : BackgroundJob {
                 return;
             }
         }
+
+        // See if the prepared job has a file associated already, then use that
+        // Usually works for import from Cameras
+        if (final_associated_file == null) {
+            final_associated_file = prepared_file.job.get_associated_file();
+        }
         
         debug("Importing %s", final_file.get_path());
         
diff --git a/src/camera/ImportPage.vala b/src/camera/ImportPage.vala
index c4fe39c..18dea09 100644
--- a/src/camera/ImportPage.vala
+++ b/src/camera/ImportPage.vala
@@ -615,20 +615,13 @@ public class ImportPage : CheckerboardPage {
             
             return true;
         }
-        
-        public override bool complete(MediaSource source, BatchImportRoll import_roll) throws Error {
-            bool ret = false;
-            if (source is Photo) {
-                Photo photo = source as Photo;
-                
-                // Associate paired JPEG with RAW photo.
-                if (associated_file != null) {
-                    photo.add_backing_photo_for_development(RawDeveloper.CAMERA, associated_file);
-                    ret = true;
-                    photo.set_raw_developer(Config.Facade.get_instance().get_default_raw_developer());
-                }
+
+        public override File? get_associated_file() {
+            if (associated_file == null) {
+                return null;
             }
-            return ret;
+
+            return File.new_for_path(associated_file.filepath);
         }
     }
     


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