f-spot r4153 - trunk/src



Author: sdelcroix
Date: Fri Jul  4 14:24:31 2008
New Revision: 4153
URL: http://svn.gnome.org/viewvc/f-spot?rev=4153&view=rev

Log:
don't regenerate the thumbnail if it's newer than the image. Saves a lot of disk I/O


Modified:
   trunk/src/PixbufLoader.cs
   trunk/src/ThumbnailGenerator.cs

Modified: trunk/src/PixbufLoader.cs
==============================================================================
--- trunk/src/PixbufLoader.cs	(original)
+++ trunk/src/PixbufLoader.cs	Fri Jul  4 14:24:31 2008
@@ -124,7 +124,7 @@
 		Request (uri, order, 0, 0);
 	}
 
-	public void Request (Uri uri, int order, int width, int height)
+	public virtual void Request (Uri uri, int order, int width, int height)
 	{
 		lock (queue) {
 			if (InsertRequest (uri, order, width, height))

Modified: trunk/src/ThumbnailGenerator.cs
==============================================================================
--- trunk/src/ThumbnailGenerator.cs	(original)
+++ trunk/src/ThumbnailGenerator.cs	Fri Jul  4 14:24:31 2008
@@ -112,6 +112,17 @@
 				
 		}
 
+		public override void Request (Uri uri, int order, int width, int height)
+		{
+			if (!uri.IsFile)
+				Log.Debug ("FIXME: compute timestamp on non file uri too");
+			if (uri.IsFile && System.IO.File.Exists (ThumbnailPath (uri)) 
+				&& System.IO.File.GetLastWriteTime (ThumbnailPath (uri)) >= System.IO.File.GetLastWriteTime (uri.AbsolutePath))
+				return;
+
+			base.Request (uri, order, width, height);
+		}
+
 		protected override void ProcessRequest (RequestItem request)
 		{
 			try {



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