[f-spot] Copy XMP sidecar during import.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Copy XMP sidecar during import.
- Date: Tue, 13 Jul 2010 13:19:57 +0000 (UTC)
commit 7990d798a742b536ec4b0a86c5a03a5eb9486cb2
Author: Ruben Vermeersch <ruben savanne be>
Date: Tue Jul 13 15:17:09 2010 +0200
Copy XMP sidecar during import.
https://bugzilla.gnome.org/show_bug.cgi?id=342892
src/Import/ImportController.cs | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/src/Import/ImportController.cs b/src/Import/ImportController.cs
index f5f344a..950ec9a 100644
--- a/src/Import/ImportController.cs
+++ b/src/Import/ImportController.cs
@@ -303,13 +303,7 @@ namespace FSpot.Import
}
// Copy into photo folder.
- if (!item.DefaultVersion.Uri.Equals (destination)) {
- var file = GLib.FileFactory.NewForUri (item.DefaultVersion.Uri);
- var new_file = GLib.FileFactory.NewForUri (destination);
- file.Copy (new_file, GLib.FileCopyFlags.AllMetadata, null, null);
- copied_files.Add (destination);
- item.DefaultVersion.Uri = destination;
- }
+ CopyIfNeeded (item, destination);
// Import photo
var photo = store.CreateFrom (item, roll.Id);
@@ -335,6 +329,28 @@ namespace FSpot.Import
imported_photos.Add (photo.Id);
}
+ void CopyIfNeeded (IBrowsableItem item, SafeUri destination)
+ {
+ if (item.DefaultVersion.Uri.Equals (destination))
+ return;
+
+ // Copy image
+ var file = GLib.FileFactory.NewForUri (item.DefaultVersion.Uri);
+ var new_file = GLib.FileFactory.NewForUri (destination);
+ file.Copy (new_file, GLib.FileCopyFlags.AllMetadata, null, null);
+ copied_files.Add (destination);
+ item.DefaultVersion.Uri = destination;
+
+ // Copy XMP sidecar
+ var xmp_file = GLib.FileFactory.NewForUri (item.DefaultVersion.Uri.ReplaceExtension(".xmp"));
+ if (xmp_file.Exists) {
+ var xmp_destination = destination.ReplaceExtension (".xmp");
+ var new_xmp_file = GLib.FileFactory.NewForUri (xmp_destination);
+ xmp_file.Copy (new_xmp_file, GLib.FileCopyFlags.AllMetadata, null, null);
+ copied_files.Add (xmp_destination);
+ }
+ }
+
SafeUri FindImportDestination (IBrowsableItem item)
{
var uri = item.DefaultVersion.Uri;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]