f-spot r4546 - in trunk: . src src/Platform/Null
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4546 - in trunk: . src src/Platform/Null
- Date: Tue, 28 Oct 2008 13:56:59 +0000 (UTC)
Author: sdelcroix
Date: Tue Oct 28 13:56:59 2008
New Revision: 4546
URL: http://svn.gnome.org/viewvc/f-spot?rev=4546&view=rev
Log:
2008-10-24 Stephane Delcroix <sdelcroix novell com>
* src/Platform/Null/ThumbnailFactory.cs: working NullThumbFactory,
keeps all the thumbs in memory
Added:
trunk/src/Platform/Null/ThumbnailFactory.cs
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Oct 28 13:56:59 2008
@@ -81,7 +81,8 @@
NULL_PLATFORM_CSDISTFILES = \
$(srcdir)/Platform/Null/PreferenceBackend.cs \
- $(srcdir)/Platform/Null/ScreenSaver.cs
+ $(srcdir)/Platform/Null/ScreenSaver.cs \
+ $(srcdir)/Platform/Gnome/ThumbnailFactory.cs
F_SPOT_CSDISTFILES = \
$(srcdir)/AsyncPixbufLoader.cs \
Added: trunk/src/Platform/Null/ThumbnailFactory.cs
==============================================================================
--- (empty file)
+++ trunk/src/Platform/Null/ThumbnailFactory.cs Tue Oct 28 13:56:59 2008
@@ -0,0 +1,79 @@
+/*
+ * FSpot.Platform.Gnome.ThumnailFactory.cs
+ *
+ * Author(s):
+ * Stephane Delcroix <stephane delcroix org>
+ *
+ * Copyright 2008 Novell, Inc
+ *
+ * This is free software, See COPYING for details
+ */
+
+using System;
+using FSpot.Utils;
+using System.Collections.Generic;
+using Gdk;
+
+namespace FSpot.Platform
+{
+ public class ThumbnailFactory
+ {
+
+ static Dictionary<Uri, Pixbuf> cache = new Dictionary<Uri, Pixbuf>();
+ public static void SaveThumbnail (Pixbuf pixbuf, Uri image_uri)
+ {
+ cache[image_uri]=pixbuf.Clone() as Pixbuf;
+ }
+
+ public static void SaveThumbnail (Pixbuf pixbuf, Uri image_uri, DateTime original_mtime)
+ {
+ cache[image_uri]=pixbuf.Clone() as Pixbuf;
+ }
+
+ public static void DeleteThumbnail (Uri image_uri)
+ {
+ cache.Remove (image_uri);
+ }
+
+ public static void MoveThumbnail (Uri from_uri, Uri to_uri)
+ {
+ Pixbuf p;
+ if (cache.TryGetValue (from_uri, out p))
+ cache[to_uri] = p;
+ cache.Remove (from_uri);
+ }
+
+ public static bool ThumbnailIsValid (Pixbuf pixbuf, Uri image_uri)
+ {
+ return cache.ContainsKey(image_uri);
+ }
+
+ public static bool ThumbnailIsValid (Pixbuf pixbuf, Uri image_uri, DateTime mtime)
+ {
+ return cache.ContainsKey(image_uri);
+ }
+
+ public static Pixbuf LoadThumbnail (Uri image_uri)
+ {
+ Pixbuf p;
+ if (cache.TryGetValue (image_uri, out p))
+ return p.Clone () as Pixbuf;
+
+ return null;
+ }
+
+ public static Pixbuf LoadThumbnail (Uri image_uri, int dest_width, int dest_height)
+ {
+ return null;
+ }
+
+ public static bool ThumbnailExists (Uri image_uri)
+ {
+ return cache.ContainsKey(image_uri);
+ }
+
+ public static bool ThumbnailIsRecent (Uri image_uri)
+ {
+ return cache.ContainsKey(image_uri);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]