[f-spot/rubenv-gsoc-2009: 64/86] Fix some warnings and a hang, also make sure thumbnails get updated after edits.



commit bf31a53bfa08352fa46bd2e2cd8d47d5f32a5c04
Author: Ruben Vermeersch <ruben savanne be>
Date:   Tue Aug 11 15:28:42 2009 +0200

    Fix some warnings and a hang, also make sure thumbnails get updated after edits.

 src/Editors/Editor.cs           |    6 ++++--
 src/Editors/RepeatableEditor.cs |    9 +++++++++
 src/Loaders/GdkImageLoader.cs   |    4 ++++
 3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/Editors/Editor.cs b/src/Editors/Editor.cs
index 58f69d4..caf93dc 100644
--- a/src/Editors/Editor.cs
+++ b/src/Editors/Editor.cs
@@ -8,9 +8,10 @@
 //
 
 using FSpot;
+using FSpot.Loaders;
+using FSpot.Platform;
 using FSpot.Utils;
 using FSpot.Widgets;
-using FSpot.Loaders;
 
 using Gdk;
 using Gtk;
@@ -159,6 +160,7 @@ namespace FSpot.Editors {
 			photo.SaveVersion (pixbuf, create_version);
 			photo.Changes.DataChanged = true;
 			Core.Database.Photos.Commit (photo);
+			ThumbnailFactory.DeleteThumbnail (photo.DefaultVersionUri);
 		}
 
 		protected abstract Pixbuf Process (Pixbuf input, Cms.Profile input_profile);
@@ -285,7 +287,7 @@ namespace FSpot.Editors {
 			if (Preview != null)
 				Preview.Dispose ();
 
-			if (State.PhotoImageView.Pixbuf != Original && Original != null)
+			if (StateInitialized && State.PhotoImageView.Pixbuf != Original && Original != null)
 				Original.Dispose ();
 
 			Preview = null;
diff --git a/src/Editors/RepeatableEditor.cs b/src/Editors/RepeatableEditor.cs
index 3ee08dd..7511d1b 100644
--- a/src/Editors/RepeatableEditor.cs
+++ b/src/Editors/RepeatableEditor.cs
@@ -9,6 +9,7 @@
 
 using FSpot.Editors.Processing;
 using FSpot.Loaders;
+using FSpot.Platform;
 using FSpot.Utils;
 using Gdk;
 using System;
@@ -85,6 +86,7 @@ namespace FSpot.Editors {
 
 			photo.Changes.DataChanged = true;
 			Core.Database.Photos.Commit (photo);
+			ThumbnailFactory.DeleteThumbnail (photo.DefaultVersionUri);
 		}
 
 		public override EditorState CreateState ()
@@ -92,8 +94,11 @@ namespace FSpot.Editors {
 			return new RepeatableEditorState ();
 		}
 
+		bool have_full_preview = false;
 		sealed protected override Pixbuf GetPreviewInput ()
 		{
+			have_full_preview = false;
+
 			// Figure out the original version to process
 			Photo photo = State.Items [0] as Photo;
 			PhotoVersion version = photo.DefaultVersion;
@@ -118,6 +123,9 @@ namespace FSpot.Editors {
 		{
 			IImageLoader loader = sender as IImageLoader;
 
+			if (have_full_preview)
+				return;
+
 			if (!args.Items.Contains (ImageLoaderItem.Full))
 				return;
 
@@ -138,6 +146,7 @@ namespace FSpot.Editors {
 			if (old_preview != null)
 				old_preview.Dispose ();
 
+			have_full_preview = true;
 			full.Dispose ();
 			loader.Dispose ();
 		}
diff --git a/src/Loaders/GdkImageLoader.cs b/src/Loaders/GdkImageLoader.cs
index 2f632da..ddcf643 100644
--- a/src/Loaders/GdkImageLoader.cs
+++ b/src/Loaders/GdkImageLoader.cs
@@ -65,6 +65,10 @@ namespace FSpot.Loaders {
 
 			ItemsRequested |= items;
 
+			// Full equals Large for GdkImageLoader
+			if (ItemsRequested.Contains (ImageLoaderItem.Full))
+				ItemsRequested |= ImageLoaderItem.Large;
+
 			StartLoading ();
 
 			if (!async)



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