[f-spot: 24/40] Send the thumb first
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Subject: [f-spot: 24/40] Send the thumb first
- Date: Wed, 24 Jun 2009 09:49:43 +0000 (UTC)
commit 190b6fb014ff81c441bc87cbe1c1d75acd102222
Author: Stephane Delcroix <stephane delcroix org>
Date: Mon Jun 22 11:46:02 2009 +0200
Send the thumb first
If we can get a thumb, send it first as loader pixbuf and trigger the prepared and updated events
src/ImageLoader.cs | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/src/ImageLoader.cs b/src/ImageLoader.cs
index 21cf957..2745192 100644
--- a/src/ImageLoader.cs
+++ b/src/ImageLoader.cs
@@ -10,10 +10,9 @@
//
using System;
-
using Gdk;
-
using FSpot.Utils;
+using FSpot.Platform;
namespace FSpot {
public class AreaPreparedEventArgs : EventArgs
@@ -55,6 +54,16 @@ namespace FSpot {
if (is_disposed)
return;
+ //First, send a thumbnail if we have one
+ if ((thumb = ThumbnailFactory.LoadThumbnail (uri)) != null) {
+ EventHandler<AreaPreparedEventArgs> prep = AreaPrepared;
+ if (prep != null)
+ prep (this, new AreaPreparedEventArgs (true));
+ EventHandler<AreaUpdatedEventArgs> upd = AreaUpdated;
+ if (upd != null)
+ upd (this, new AreaUpdatedEventArgs (new Rectangle (0, 0, thumb.Width, thumb.Height)));
+ }
+
using (ImageFile image_file = ImageFile.Create (uri)) {
image_stream = image_file.PixbufStream ();
pixbuf_orientation = image_file.Orientation;
@@ -63,10 +72,20 @@ namespace FSpot {
loading = true;
}
- new public event EventHandler<AreaUpdatedEventArgs> AreaUpdated;
new public event EventHandler<AreaPreparedEventArgs> AreaPrepared;
+ new public event EventHandler<AreaUpdatedEventArgs> AreaUpdated;
public event EventHandler Completed;
+
+ Pixbuf thumb;
+ new public Pixbuf Pixbuf {
+ get {
+ if (thumb != null)
+ return thumb;
+ return base.Pixbuf;
+ }
+ }
+
bool loading = false;
public bool Loading {
get { return loading; }
@@ -95,6 +114,10 @@ namespace FSpot {
//it's normal to get an exception here if we're closing in the early loading stages, and it's safe to ignore
// that exception as we don't want the loading to finish but want to cancel it.
}
+ if (thumb != null) {
+ thumb.Dispose ();
+ thumb = null;
+ }
base.Dispose ();
}
#endregion
@@ -105,6 +128,11 @@ namespace FSpot {
if (is_disposed)
return;
+ if (thumb != null) {
+ thumb.Dispose ();
+ thumb = null;
+ }
+
prepared = notify_prepared = true;
damage = Rectangle.Zero;
base.OnAreaPrepared ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]