[mistelix] Fixes issue #584498



commit dfc13840d4e4a1744e5b7d00320ee4a699a76913
Author: Jordi Mas <jmas softcatala org>
Date:   Mon Jul 6 14:31:11 2009 +0100

    Fixes issue #584498

 src/dialogs/AddSlideDialog.cs     |   60 ++++++++++++++++++------------------
 src/mistelix.cs                   |   13 +++++--
 src/widgets/ProjectElementView.cs |    4 +-
 3 files changed, 41 insertions(+), 36 deletions(-)
---
diff --git a/src/dialogs/AddSlideDialog.cs b/src/dialogs/AddSlideDialog.cs
index 88b2f27..0462b20 100644
--- a/src/dialogs/AddSlideDialog.cs
+++ b/src/dialogs/AddSlideDialog.cs
@@ -118,40 +118,40 @@ namespace Mistelix.Dialogs
 			duration_spin.ValueChanged += new EventHandler (TimeValueChanged);
 		}
 
-		public SlideShow SlideShow {
-			get {
-				Logger.Debug ("AddSlideDialog.SlideShow. Get");
-
-				if (edit_mode == true) { // Reuse the same object, only store the images again
-					slide.images.Clear ();
-				} else {
-					slide = new SlideShow ();
-				}
+		public void LoadSlideShow (SlideShow slide)
+		{
+			this.slide = slide;
+			image_view.LoadSlideShow (slide);
+			audiofile = slide.AudioFile;
+			edit_mode = true;			
+		}
+		
+		public SlideShow GenerateSlideShow ()
+		{
+			Logger.Debug ("AddSlideDialog.GenerateSlideShow.");
 
-				TreeIter iter;
-				bool more;
-				SlideImage image;
-				more = image_view.Model.GetIterFirst (out iter);
-				slide.AudioFile = audiofile;
-				
-				while (more)
-				{
-					image = (SlideImage) image_view.Model.GetValue (iter, SlideShowImageView.COL_OBJECT);
-					image.Project = this.project;
-					slide.images.Add (image);
-					more = image_view.Model.IterNext (ref iter);
-				}
-				return slide;
+			if (edit_mode == true) { // Reuse the same object, only store the images again
+				slide.images.Clear ();
+			} else {
+				slide = new SlideShow ();
 			}
-			set {
-				slide = value;
-				image_view.LoadSlideShow (value);
-				audiofile = slide.AudioFile;
-				edit_mode = true;
+
+			TreeIter iter;
+			bool more;
+			SlideImage image;
+			more = image_view.Model.GetIterFirst (out iter);
+			slide.AudioFile = audiofile;
+			
+			while (more)
+			{
+				image = (SlideImage) image_view.Model.GetValue (iter, SlideShowImageView.COL_OBJECT);
+				image.Project = this.project;
+				slide.images.Add (image);
+				more = image_view.Model.IterNext (ref iter);
 			}
+			return slide;
 		}
 
-
 		void OnDirectoryChanged (object sender, ChangeDirectoryEventArgs args)
 		{
 			file_view.OnDirChanged (args.Directory);
@@ -326,7 +326,7 @@ namespace Mistelix.Dialogs
 		
 		void OnSlideShowPreview (object sender, EventArgs args) 
 		{
-			SlideShow slide_show = this.SlideShow;
+			SlideShow slide_show = GenerateSlideShow ();
 			SlideShowView slide_show_view = new SlideShowView(slide_show);
 			FullScreenWindow full_screen = new FullScreenWindow(slide_show_view);
 			Dialog.Respond (ResponseType.Ok);
diff --git a/src/mistelix.cs b/src/mistelix.cs
index ab5b3df..ef69bd0 100644
--- a/src/mistelix.cs
+++ b/src/mistelix.cs
@@ -196,10 +196,15 @@ namespace Mistelix
 		{
 			AddSlideDialog dialog = new AddSlideDialog (this.project);
 
-			if (dialog.RunNoDestroy () == ResponseType.Ok && dialog.SlideShow.images.Count > 0) {
-				Logger.Debug ("Mistelix.OnSlideshowsButtonClicked. Ok");
-				project.AddElement (dialog.SlideShow);
-				element_view.AddElement (dialog.SlideShow);
+			if (dialog.RunNoDestroy () == ResponseType.Ok) {
+
+				SlideShow slideshow = dialog.GenerateSlideShow ();
+
+				if (slideshow.images.Count > 0) {
+					Logger.Debug ("Mistelix.OnSlideshowsButtonClicked. Ok");
+					project.AddElement (slideshow);
+					element_view.AddElement (slideshow);
+				}
 			}
 			dialog.Destroy ();
 		}
diff --git a/src/widgets/ProjectElementView.cs b/src/widgets/ProjectElementView.cs
index 52df205..2b2d1f8 100644
--- a/src/widgets/ProjectElementView.cs
+++ b/src/widgets/ProjectElementView.cs
@@ -271,13 +271,13 @@ namespace Mistelix.Widgets
 				return;
 
 			AddSlideDialog dialog = new AddSlideDialog (this.project);
-			dialog.SlideShow = (SlideShow) current;
+			dialog.LoadSlideShow ((SlideShow) current);
 
 			if (dialog.RunNoDestroy () == ResponseType.Ok) {
 				for (int i = 0; i < project.Elements.Count; i++)
 				{
 					if (current == project.Elements[i]) {
-						project.Elements[i] = dialog.SlideShow;
+						project.Elements[i] = dialog.GenerateSlideShow ();
 						UpdateElement (project.Elements[i]);
 						break;
 					}



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