[f-spot/mipmapped-loading: 5/12] Let PhotoLoaderCache use ILoadable as indices.



commit 0e213491008f49b5bbcd7581daa88a7134359a01
Author: Ruben Vermeersch <ruben savanne be>
Date:   Sun Jun 20 14:34:46 2010 +0200

    Let PhotoLoaderCache use ILoadable as indices.

 src/Loaders/PhotoLoaderCache.cs |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/Loaders/PhotoLoaderCache.cs b/src/Loaders/PhotoLoaderCache.cs
index ab9e5b3..6af2033 100644
--- a/src/Loaders/PhotoLoaderCache.cs
+++ b/src/Loaders/PhotoLoaderCache.cs
@@ -5,24 +5,25 @@ namespace FSpot.Loaders
 {
     public class PhotoLoaderCache
     {
-        Dictionary<string, WeakReference> Loaders = new Dictionary<string, WeakReference>();
+        Dictionary<ILoadable, WeakReference> Loaders = new Dictionary<ILoadable, WeakReference>();
 
         public IPhotoLoader RequestLoader (ILoadable photo)
         {
-            var key = photo.Uri.ToString ();
             WeakReference reference = null;
             IPhotoLoader loader = null;
 
-            if (Loaders.TryGetValue (key, out reference)) {
+            if (Loaders.TryGetValue (photo, out reference)) {
                 loader = reference.Target as IPhotoLoader;
             }
 
             if (loader == null) {
                 loader = new XdgThumbnailLoader (photo);
-                Loaders[key] = new WeakReference (loader);
+                Loaders[photo] = new WeakReference (loader);
             }
 
             return loader;
         }
+
+		// FIXME: periodically purge
     }
 }



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