[longomatch] Implement proper behaviour for SaveLoadedProject function.



commit fcc7631e79b913644821409cba536bb4b4b8e798
Author: Julien Moutte <julien fluendo com>
Date:   Mon Mar 16 12:46:37 2015 +0100

    Implement proper behaviour for SaveLoadedProject function.
    
    Previously we were saving to database even when the loaded project was not edited. We were also 
completely ignoring the force flag.

 LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs 
b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
index fbf1301..8f67e84 100644
--- a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
@@ -103,15 +103,19 @@ namespace LongoMatch.Gui.Panel
                void SaveLoadedProject (bool force)
                {
                        if (loadedProject != null) {
-                               if (edited) {
+                               bool save = edited;
+
+                               if (edited && !force) {
                                        string msg = Catalog.GetString ("Do you want to save the current 
template");
                                        if (!Config.GUIToolkit.QuestionMessage (msg, null, this)) {
-                                               return;
+                                               save = false;
                                        }
                                }
-                               DB.UpdateProject (loadedProject);
-                               projectlistwidget1.UpdateProject (loadedProject.Description);
-                               edited = false;
+                               if (save) {
+                                       DB.UpdateProject (loadedProject);
+                                       projectlistwidget1.UpdateProject (loadedProject.Description);
+                                       edited = false;
+                               }
                        }
                }
 


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