[longomatch] Better handling for projects deletion.



commit c713f3040c804360029d7b1524ad7bc8ebaea6a2
Author: Julien Moutte <julien fluendo com>
Date:   Mon Mar 16 12:47:40 2015 +0100

    Better handling for projects deletion.
    
    When deleting currently loaded project we should make sure it's not loaded anymore. Also when there are 
no more projects in DB, hide the project details widget.

 LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs 
b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
index 8f67e84..337b96c 100644
--- a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
@@ -250,11 +250,20 @@ namespace LongoMatch.Gui.Panel
                                }
                                string msg = Catalog.GetString ("Do you really want to delete:") + "\n" + 
selectedProject.Title;
                                if (MessagesHelpers.QuestionMessage (this, msg)) {
+                                       // Unload first
+                                       if (loadedProject != null && loadedProject.ID == selectedProject.ID) {
+                                               loadedProject = null;
+                                       }
                                        DB.RemoveProject (selectedProject.ID);
                                        deletedProjects.Add (selectedProject);
                                }
                        }
                        projectlistwidget1.RemoveProjects (deletedProjects);
+
+                       // In the case where there are no projects left we need to clear the project desc 
widget
+                       if (DB.GetAllProjects ().Count == 0) {
+                               rbox.Visible = false;
+                       }
                }
                
                void HandleOpenClicked (object sender, EventArgs e)


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