[f-spot/backend-cleanup: 4/8] Replace usage of Photo to IBrowseableItem in SyncMetadataJob.cs



commit 7e98fea3c76d52b9a4695e4552e67dfd45a3fa2f
Author: Mike Gemünde <mike gemuende de>
Date:   Tue Jul 6 15:45:20 2010 +0200

    Replace usage of Photo to IBrowseableItem in SyncMetadataJob.cs

 src/Jobs/SyncMetadataJob.cs |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/Jobs/SyncMetadataJob.cs b/src/Jobs/SyncMetadataJob.cs
index e4d2ec6..6f804b3 100644
--- a/src/Jobs/SyncMetadataJob.cs
+++ b/src/Jobs/SyncMetadataJob.cs
@@ -23,9 +23,9 @@ namespace FSpot.Jobs {
 		}
 
 		//Use THIS static method to create a job...
-		public static SyncMetadataJob Create (JobStore job_store, Photo photo)
+		public static SyncMetadataJob Create (JobStore job_store, IBrowsableItem photo)
 		{
-			return (SyncMetadataJob) job_store.CreatePersistent (typeof (FSpot.Jobs.SyncMetadataJob), photo.Id.ToString ());
+			return (SyncMetadataJob) job_store.CreatePersistent (typeof (FSpot.Jobs.SyncMetadataJob), photo.DefaultVersion.Uri.AbsoluteUri);
 		}
 
 		protected override bool Execute ()
@@ -34,7 +34,7 @@ namespace FSpot.Jobs {
 			System.Threading.Thread.Sleep (500);
 			Log.Debug ("Syncing metadata to file...");
 			try {
-				Photo photo = FSpot.App.Instance.Database.Photos.Get (Convert.ToUInt32 (JobOptions)) as Photo;
+				IBrowsableItem photo = FSpot.App.Instance.Database.Photos.Get (Convert.ToUInt32 (JobOptions));
 				WriteMetadataToImage (photo);
 				return true;
 			} catch (System.Exception e) {
@@ -44,7 +44,7 @@ namespace FSpot.Jobs {
 		}
 
 		//FIXME: Won't work on non-file uris
-		void WriteMetadataToImage (Photo photo)
+		void WriteMetadataToImage (IBrowsableItem photo)
 		{
 			string path = photo.DefaultVersion.Uri.LocalPath;
 	
@@ -70,7 +70,7 @@ namespace FSpot.Jobs {
 			}
 		}
 		
-		private static FSpot.Xmp.XmpFile UpdateXmp (FSpot.IBrowsableItem item, FSpot.Xmp.XmpFile xmp)
+		private static FSpot.Xmp.XmpFile UpdateXmp (IBrowsableItem item, FSpot.Xmp.XmpFile xmp)
 		{
 			if (xmp == null) 
 				xmp = new FSpot.Xmp.XmpFile ();
@@ -82,8 +82,8 @@ namespace FSpot.Jobs {
 				names [i] = tags [i].Name;
 			
 			xmp.Store.Update ("dc:subject", "rdf:Bag", names);
-			if ((item as Photo).Rating > 0) {
-				xmp.Store.Update ("xmp:Rating", (item as Photo).Rating.ToString());
+			if (item.Rating > 0) {
+				xmp.Store.Update ("xmp:Rating", item.Rating.ToString());
 				// FIXME - Should we also store/overwrite the Urgency field?
 				// uint urgency_value = (item as Photo).Rating + 1; // Urgency valid values 1 - 8
 				// xmp.Store.Update ("photoshop:Urgency", urgency_value.ToString());



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