[f-spot/taglib-metadata] Remove a lot of duplicated functionality between FileImportSource and FileBrowsableItem.



commit f3d18d5ffce24be2a0e880465969ab09f6df716b
Author: Ruben Vermeersch <ruben savanne be>
Date:   Sat Jul 3 11:38:54 2010 +0200

    Remove a lot of duplicated functionality between FileImportSource and FileBrowsableItem.

 src/Import/FileImportSource.cs |   52 +--------------------------------------
 src/Import/ImportSource.cs     |   24 ------------------
 2 files changed, 2 insertions(+), 74 deletions(-)
---
diff --git a/src/Import/FileImportSource.cs b/src/Import/FileImportSource.cs
index 7f68d5a..724ad63 100644
--- a/src/Import/FileImportSource.cs
+++ b/src/Import/FileImportSource.cs
@@ -140,61 +140,13 @@ namespace FSpot.Import
         }
     }
 
-    internal class FileImportInfo : IBrowsableItem {
-		bool metadata_parsed = false;
-
-        public FileImportInfo (SafeUri original)
+    internal class FileImportInfo : FileBrowsableItem {
+        public FileImportInfo (SafeUri original) : base (original)
         {
-            DefaultVersion = new ImportInfoVersion () {
-                BaseUri = original.GetBaseUri (),
-                Filename = original.GetFilename ()
-            };
         }
 
-		private void EnsureMetadataParsed ()
-		{
-			if (metadata_parsed)
-				return;
-
-			using (var metadata = Metadata.Parse (DefaultVersion.Uri)) {
-				var date = metadata.ImageTag.DateTime;
-				time = date.HasValue ? date.Value : CreateDate;
-				description = metadata.ImageTag.Comment;
-			}
-
-			metadata_parsed = true;
-		}
-
-        public IBrowsableItemVersion DefaultVersion { get; private set; }
         public SafeUri DestinationUri { get; set; }
 
-        private DateTime time;
-        public System.DateTime Time {
-            get {
-				EnsureMetadataParsed ();
-                return time;
-            }
-        }
-
-		private string description;
-		public string Description {
-			get {
-				EnsureMetadataParsed ();
-				return description;
-			}
-		}
-
-        private DateTime CreateDate {
-            get {
-                var info = GLib.FileFactory.NewForUri (DefaultVersion.Uri).QueryInfo ("time::changed", GLib.FileQueryInfoFlags.None, null);
-                return NativeConvert.ToDateTime ((long)info.GetAttributeULong ("time::changed"));
-            }
-        }
-
-        public Tag [] Tags { get { throw new NotImplementedException (); } }
-        public string Name { get { throw new NotImplementedException (); } }
-        public uint Rating { get { return 0; } }
-
         internal uint PhotoId { get; set; }
     }
 }
diff --git a/src/Import/ImportSource.cs b/src/Import/ImportSource.cs
index ec496d3..2ee01de 100644
--- a/src/Import/ImportSource.cs
+++ b/src/Import/ImportSource.cs
@@ -10,28 +10,4 @@ namespace FSpot.Import
         void StartPhotoScan (ImportController controller);
         void Deactivate ();
     }
-
-	public class ImportInfoVersion : IBrowsableItemVersion {
-		public string Name { get { return String.Empty; } }
-		public bool IsProtected { get { return true; } }
-		public SafeUri BaseUri { get; set; }
-		public string Filename { get; set; }
-
-		public SafeUri Uri {
-            get { return BaseUri.Append (Filename); }
-            set {
-                BaseUri = value.GetBaseUri ();
-                Filename = value.GetFilename ();
-            }
-        }
-
-        private string import_md5 = String.Empty;
-        public string ImportMD5 {
-            get {
-                if (import_md5 == String.Empty)
-                    import_md5 = HashUtils.GenerateMD5 (Uri);
-                return import_md5;
-            }
-        }
-	}
 }



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