[f-spot] Always fall back to XMP sidecar if file might be corrupt.



commit 2e36b7a65bc5f72147d605cf498b550c00fc4be0
Author: Ruben Vermeersch <ruben savanne be>
Date:   Mon Jul 12 18:00:10 2010 +0200

    Always fall back to XMP sidecar if file might be corrupt.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=624097

 po/POTFILES.in              |    3 ++-
 src/Jobs/SyncMetadataJob.cs |    9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 74f3050..19fdf63 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -71,6 +71,7 @@ src/Imaging/ImageFile.cs
 src/Import/ImportController.cs
 src/Import/MetadataImporter.cs
 src/ItemAction.cs
+src/Jobs/SyncMetadataJob.cs
 src/Loupe.cs
 src/MainWindow.cs
 src/PhotoPopup.cs
@@ -107,6 +108,7 @@ src/UI.Dialog/RepairDbDialog.cs
 src/UI.Dialog/SelectionRatioDialog.cs
 src/UI.Dialog/ThreadProgressDialog.cs
 [type: gettext/glade]src/UI.Dialog/ui/AdjustTimeDialog.ui
+[type: gettext/glade]src/UI.Dialog/ui/CreateTagDialog.ui
 [type: gettext/glade]src/UI.Dialog/ui/DateRangeDialog.ui
 [type: gettext/glade]src/UI.Dialog/ui/EditTagDialog.ui
 [type: gettext/glade]src/UI.Dialog/ui/EditTagIconDialog.ui
@@ -114,7 +116,6 @@ src/UI.Dialog/ThreadProgressDialog.cs
 [type: gettext/glade]src/UI.Dialog/ui/PreferenceDialog.ui
 [type: gettext/glade]src/UI.Dialog/ui/RatingFilterDialog.ui
 [type: gettext/glade]src/UI.Dialog/ui/RepairDialog.ui
-[type: gettext/glade]src/UI.Dialog/ui/CreateTagDialog.ui
 [type: gettext/glade]src/ui/import.ui
 [type: gettext/glade]src/ui/mail_dialog.ui
 [type: gettext/glade]src/ui/main_window.ui
diff --git a/src/Jobs/SyncMetadataJob.cs b/src/Jobs/SyncMetadataJob.cs
index cfaba73..7e1e93b 100644
--- a/src/Jobs/SyncMetadataJob.cs
+++ b/src/Jobs/SyncMetadataJob.cs
@@ -11,6 +11,7 @@ using System;
 using Banshee.Kernel;
 using Hyena;
 using FSpot.Utils;
+using Mono.Unix;
 
 namespace FSpot.Jobs {
     public class SyncMetadataJob : Job
@@ -62,8 +63,12 @@ namespace FSpot.Jobs {
                 tag.Rating = photo.Rating;
                 tag.Software = FSpot.Defines.PACKAGE + " version " + FSpot.Defines.VERSION;
 
-                Hyena.Log.Information (photo.DefaultVersion.Uri);
-                if (Preferences.Get<bool> (Preferences.METADATA_ALWAYS_USE_SIDECAR) || !metadata.Writeable) {
+                var always_sidecar = Preferences.Get<bool> (Preferences.METADATA_ALWAYS_USE_SIDECAR);
+                if (always_sidecar || !metadata.Writeable || metadata.PossiblyCorrupt) {
+                    if (!always_sidecar && metadata.PossiblyCorrupt) {
+                        Log.WarningFormat (Catalog.GetString ("Metadata of file {0} may be corrupt, refusing to write to it, falling back to XMP sidecar."), photo.DefaultVersion.Uri);
+                    }
+
                     var sidecar_res = new GIOTagLibFileAbstraction () { Uri = photo.DefaultVersion.Uri.ReplaceExtension (".xmp") };
 
                     metadata.SaveXmpSidecar (sidecar_res);



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