[f-spot/icon-view-cleanup: 9/24] FileBrowsableItem -> FilePhoto.



commit b2b8d4c41550015e39e6478f2834f4f1508c41f4
Author: Ruben Vermeersch <ruben savanne be>
Date:   Fri Aug 13 18:32:46 2010 +0200

    FileBrowsableItem -> FilePhoto.

 .../MainApp/FSpot.Import/FileImportSource.cs       |    2 +-
 src/Clients/MainApp/FSpot/UriCollection.cs         |   18 +++---
 src/Core/FSpot.Core/FSpot.Core.csproj              |    2 +-
 .../{FileBrowsableItem.cs => FilePhoto.cs}         |   59 +++++++++++---------
 src/Core/FSpot.Core/Makefile.am                    |    2 +-
 5 files changed, 44 insertions(+), 39 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.Import/FileImportSource.cs b/src/Clients/MainApp/FSpot.Import/FileImportSource.cs
index d16f97f..e18d237 100644
--- a/src/Clients/MainApp/FSpot.Import/FileImportSource.cs
+++ b/src/Clients/MainApp/FSpot.Import/FileImportSource.cs
@@ -141,7 +141,7 @@ namespace FSpot.Import
         }
     }
 
-    internal class FileImportInfo : FileBrowsableItem {
+    internal class FileImportInfo : FilePhoto {
         public FileImportInfo (SafeUri original) : base (original)
         {
         }
diff --git a/src/Clients/MainApp/FSpot/UriCollection.cs b/src/Clients/MainApp/FSpot/UriCollection.cs
index ff09ed7..286078d 100644
--- a/src/Clients/MainApp/FSpot/UriCollection.cs
+++ b/src/Clients/MainApp/FSpot/UriCollection.cs
@@ -43,7 +43,7 @@ namespace FSpot {
 		{
 			if (ImageFile.HasLoader (uri)) {
 				//Console.WriteLine ("using image loader {0}", uri.ToString ());
-				Add (new FileBrowsableItem (uri));
+				Add (new FilePhoto (uri));
 			} else {
 				GLib.FileInfo info = FileFactory.NewForUri (uri).QueryInfo ("standard::type,standard::content-type", FileQueryInfoFlags.None, null);
 
@@ -79,12 +79,12 @@ namespace FSpot {
 				ns.AddNamespace ("pheed", "http://www.pheed.com/pheed/";);
 				ns.AddNamespace ("apple", "http://www.apple.com/ilife/wallpapers";);
 
-				ArrayList items = new ArrayList ();
+				List<FilePhoto> items = new List<FilePhoto> ();
 				XmlNodeList list = doc.SelectNodes ("/rss/channel/item/media:content", ns);
 				foreach (XmlNode item in list) {
 					SafeUri image_uri = new SafeUri (item.Attributes ["url"].Value);
 					Hyena.Log.DebugFormat ("flickr uri = {0}", image_uri.ToString ());
-					items.Add (new FileBrowsableItem (image_uri));
+					items.Add (new FilePhoto (image_uri));
 				}
 
 				if (list.Count < 1) {
@@ -92,7 +92,7 @@ namespace FSpot {
 					foreach (XmlNode item in list) {
 						SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
 						Hyena.Log.DebugFormat ("pheed uri = {0}", uri);
-						items.Add (new FileBrowsableItem (image_uri));
+						items.Add (new FilePhoto (image_uri));
 					}
 				}
 
@@ -101,10 +101,10 @@ namespace FSpot {
 					foreach (XmlNode item in list) {
 						SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
 						Hyena.Log.DebugFormat ("apple uri = {0}", uri);
-						items.Add (new FileBrowsableItem (image_uri));
+						items.Add (new FilePhoto (image_uri));
 					}
 				}
-				collection.Add (items.ToArray (typeof (FileBrowsableItem)) as FileBrowsableItem []);
+				collection.Add (items.ToArray ());
 			}
 		}
 
@@ -127,12 +127,12 @@ namespace FSpot {
 
 			void InfoLoaded (GLib.Object o, GLib.AsyncResult res)
 			{
-				List<FileBrowsableItem> items = new List<FileBrowsableItem> ();
+				List<FilePhoto> items = new List<FilePhoto> ();
 				foreach (GLib.FileInfo info in file.EnumerateChildrenFinish (res)) {
 					SafeUri i = new SafeUri (file.GetChild (info.Name).Uri);
 					Hyena.Log.DebugFormat ("testing uri = {0}", i);
 					if (ImageFile.HasLoader (i))
-						items.Add (new FileBrowsableItem (i));
+						items.Add (new FilePhoto (i));
 				}
 				ThreadAssist.ProxyToMain (() => {
 					collection.Add (items.ToArray ());
@@ -146,7 +146,7 @@ namespace FSpot {
 			foreach (var f in files) {
 				if (ImageFile.HasLoader (new SafeUri (f.FullName))) {
 					Hyena.Log.Debug (f.FullName);
-					items.Add (new FileBrowsableItem (new SafeUri (f.FullName)));
+					items.Add (new FilePhoto (new SafeUri (f.FullName)));
 				}
 			}
 
diff --git a/src/Core/FSpot.Core/FSpot.Core.csproj b/src/Core/FSpot.Core/FSpot.Core.csproj
index b2c33f0..7bc3c35 100644
--- a/src/Core/FSpot.Core/FSpot.Core.csproj
+++ b/src/Core/FSpot.Core/FSpot.Core.csproj
@@ -30,7 +30,6 @@
     <Compile Include="FSpot.Core\DbItem.cs" />
     <Compile Include="FSpot.Core\Tag.cs" />
     <Compile Include="FSpot.Core\Global.cs" />
-    <Compile Include="FSpot.Core\FileBrowsableItem.cs" />
     <Compile Include="FSpot.Core\IBrowsableItemChanges.cs" />
     <Compile Include="FSpot.Core\IBrowsableCollection.cs" />
     <Compile Include="FSpot.Core\ILoadable.cs" />
@@ -43,6 +42,7 @@
     <Compile Include="FSpot.Core\IPhotoComparer.cs" />
     <Compile Include="FSpot.Core\IPhotoVersion.cs" />
     <Compile Include="FSpot.Core\IPhotoVersionable.cs" />
+    <Compile Include="FSpot.Core\FilePhoto.cs" />
   </ItemGroup>
   <ProjectExtensions>
     <MonoDevelop>
diff --git a/src/Core/FSpot.Core/FSpot.Core/FileBrowsableItem.cs b/src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs
similarity index 68%
rename from src/Core/FSpot.Core/FSpot.Core/FileBrowsableItem.cs
rename to src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs
index a162a99..a5b1515 100644
--- a/src/Core/FSpot.Core/FSpot.Core/FileBrowsableItem.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/FilePhoto.cs
@@ -1,5 +1,5 @@
 /*
- * FileBrowsableItem.cs
+ * FilePhoto.cs
  *
  * Author(s):
  *	Larry Ewing  (lewing novell com)
@@ -19,29 +19,28 @@ using FSpot.Utils;
 
 using Mono.Unix.Native;
 
-namespace FSpot.Core {
-    public class FileBrowsableItem : IPhoto
+namespace FSpot.Core
+{
+    public class FilePhoto : IPhoto
     {
         bool metadata_parsed = false;
 
-        public FileBrowsableItem (SafeUri uri)
+        public FilePhoto (SafeUri uri)
         {
-            DefaultVersion = new FileBrowsableItemVersion () {
-                Uri = uri
-            };
+            DefaultVersion = new FilePhotoVersion { Uri = uri };
         }
 
         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;
         }
 
@@ -52,10 +51,8 @@ namespace FSpot.Core {
             }
         }
 
-        public Tag [] Tags {
-            get {
-                return null;
-            }
+        public Tag[] Tags {
+            get { return null; }
         }
 
         private DateTime time;
@@ -68,9 +65,11 @@ namespace FSpot.Core {
 
         public IPhotoVersion DefaultVersion { get; private set; }
 
-		public IEnumerable<IPhotoVersion> Versions {
-			get { yield return DefaultVersion; }
-		}
+        public IEnumerable<IPhotoVersion> Versions {
+            get {
+                yield return DefaultVersion;
+            }
+        }
 
         private string description;
         public string Description {
@@ -81,23 +80,29 @@ namespace FSpot.Core {
         }
 
         public string Name {
-            get {
-                return DefaultVersion.Uri.GetFilename ();
-            }
+            get { return DefaultVersion.Uri.GetFilename (); }
         }
 
         public uint Rating {
-            get {
-                return 0; //FIXME ndMaxxer: correct?
-            }
+                //FIXME ndMaxxer: correct?
+            get { return 0; }
         }
 
-        private class FileBrowsableItemVersion : IPhotoVersion {
-            public string Name { get { return String.Empty; } }
-            public bool IsProtected { get { return true; } }
+        private class FilePhotoVersion : IPhotoVersion
+        {
+            public string Name {
+                get { return String.Empty; }
+            }
+            public bool IsProtected {
+                get { return true; }
+            }
 
-            public SafeUri BaseUri { get { return Uri.GetBaseUri (); } }
-            public string Filename { get { return Uri.GetFilename (); } }
+            public SafeUri BaseUri {
+                get { return Uri.GetBaseUri (); }
+            }
+            public string Filename {
+                get { return Uri.GetFilename (); }
+            }
             public SafeUri Uri { get; set; }
 
             private string import_md5 = String.Empty;
diff --git a/src/Core/FSpot.Core/Makefile.am b/src/Core/FSpot.Core/Makefile.am
index 6d58fc7..4b03208 100644
--- a/src/Core/FSpot.Core/Makefile.am
+++ b/src/Core/FSpot.Core/Makefile.am
@@ -10,7 +10,7 @@ SOURCES =  \
 	FSpot.Core/Category.cs \
 	FSpot.Core/DbItem.cs \
 	FSpot.Core/Defines.cs \
-	FSpot.Core/FileBrowsableItem.cs \
+	FSpot.Core/FilePhoto.cs \
 	FSpot.Core/Global.cs \
 	FSpot.Core/IBrowsableCollection.cs \
 	FSpot.Core/IBrowsableItemChanges.cs \



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