[shotwell/shotwell-0.26] Rename backing photo to lower case as well



commit fc42ea3448cd742b3bc041ee5d5c0175a16d2a89
Author: Stefan Willinger <stefan home aon at>
Date:   Sun Aug 20 23:11:09 2017 +0200

    Rename backing photo to lower case as well
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777626

 src/LibraryFiles.vala      |   18 ++++++++++++++----
 src/photos/RawSupport.vala |    4 +++-
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/LibraryFiles.vala b/src/LibraryFiles.vala
index 20d43ab..a49b77b 100644
--- a/src/LibraryFiles.vala
+++ b/src/LibraryFiles.vala
@@ -36,13 +36,23 @@ public File? generate_unique_file(string basename, MediaMetadata? metadata, time
     }
     
     // Optionally convert to lower-case.
-    string newbasename = basename;
-    if (Config.Facade.get_instance().get_use_lowercase_filenames())
-        newbasename = newbasename.down();
+    string newbasename = convert_basename(basename);
     
     return global::generate_unique_file(dir, newbasename, out collision);
 }
 
+// Create the basename for files in the library.
+// Depending on the setting USE_LOWERCASE_FILENAMES the basename will be converted to lower case or not
+public string convert_basename(string basename) {
+    if (Config.Facade.get_instance().get_use_lowercase_filenames()) {
+        return basename.down();
+    } else {
+        return basename;
+    }
+
+}
+
+
 // This function is thread-safe.
 private File duplicate(File src, FileProgressCallback? progress_callback, bool blacklist) throws Error {
     time_t timestamp = 0;
@@ -59,7 +69,7 @@ private File duplicate(File src, FileProgressCallback? progress_callback, bool b
             metadata = reader.read_metadata();
         } catch (Error err) {
             // ignored, leave metadata as null
-        }            
+        }
     } else {
         PhotoFileReader reader = PhotoFileFormat.get_by_file_extension(src).create_reader(
             src.get_path());
diff --git a/src/photos/RawSupport.vala b/src/photos/RawSupport.vala
index 05f652c..d11d06e 100644
--- a/src/photos/RawSupport.vala
+++ b/src/photos/RawSupport.vala
@@ -352,8 +352,10 @@ public enum RawDeveloper {
             basename = camera_development_filename;
         }
         
+        string newbasename = LibraryFiles.convert_basename(basename);
+
         bool c;
-        File? new_back = generate_unique_file(master.get_parent(), basename, out c);
+        File? new_back = generate_unique_file(master.get_parent(), newbasename, out c);
         claim_file(new_back);
         ns.file_format = PhotoFileFormat.JFIF;
         ns.filepath = new_back.get_path();


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