[longomatch] Fix Bug 594329 - Cannot change the file associated to a project in the Projects Mamager



commit 31e368360c5155b119499b83bcf1f6ff7985de7d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Sep 6 21:19:18 2009 +0200

    Fix  Bug 594329 -  Cannot change the file associated to a project in the Projects Mamager

 LongoMatch/Gui/DBManager.cs |   41 +++++++++++++++++++----------------------
 1 files changed, 19 insertions(+), 22 deletions(-)
---
diff --git a/LongoMatch/Gui/DBManager.cs b/LongoMatch/Gui/DBManager.cs
index d9a262b..2ac33a0 100644
--- a/LongoMatch/Gui/DBManager.cs
+++ b/LongoMatch/Gui/DBManager.cs
@@ -34,7 +34,7 @@ namespace LongoMatch.Gui.Dialog
 	{
 
 		public bool edited;
-		public Project loadedProject;
+		public string originalFilePath;
 		
 		public DBManager()
 		{
@@ -51,31 +51,28 @@ namespace LongoMatch.Gui.Dialog
 			filedescriptionwidget3.Sensitive = false;
 			saveButton.Sensitive = false;
 			deleteButton.Sensitive = false;
-			loadedProject=null;	
+			originalFilePath=null;	
 		}
 		
 		private void SaveProject(){
-			String previousFileName;			
-			Project changedProject;
-			
-			changedProject = filedescriptionwidget3.GetProject();
-			previousFileName = loadedProject.File.FilePath;
-			
-			if (changedProject != null){
-				
-				if (changedProject.File.FilePath == previousFileName)
-					MainClass.DB.UpdateProject(changedProject);
-				else{
-					try{
-						MainClass.DB.UpdateProject(changedProject,previousFileName);
-					}
-					catch{
-						MessagePopup.PopupMessage(this, MessageType.Warning, 
-				                          Catalog.GetString("A Project is already using this file."));
-					}
+			Project project = filedescriptionwidget3.GetProject();
+						
+			if (project == null)
+				return;
+							
+			if (project.File.FilePath == originalFilePath)
+				MainClass.DB.UpdateProject(project);
+			else{
+				try{
+					MainClass.DB.UpdateProject(project,originalFilePath);
+				}
+				catch{
+					MessagePopup.PopupMessage(this, MessageType.Warning, 
+					                          Catalog.GetString("A Project is already using this file."));
 				}
-				Fill();
 			}
+			Fill();
+			
 		}
 
 
@@ -134,9 +131,9 @@ namespace LongoMatch.Gui.Dialog
 				deleteButton.Sensitive = false;				
 			}
 			else{
-				loadedProject = project;
 				filedescriptionwidget3.Sensitive = true;
 				filedescriptionwidget3.SetProject(project);
+				originalFilePath = project.File.FilePath;
 				saveButton.Sensitive = true;
 				deleteButton.Sensitive = true;
 			}



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