[longomatch] Release panels correctly
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Release panels correctly
- Date: Mon, 7 Jul 2014 11:30:04 +0000 (UTC)
commit d143308de1bfab3b935af1d81579842c72a9754e
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Jun 19 14:41:30 2014 +0200
Release panels correctly
LongoMatch.GUI/Gui/MainWindow.cs | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/MainWindow.cs b/LongoMatch.GUI/Gui/MainWindow.cs
index 9724bd0..49de6bd 100644
--- a/LongoMatch.GUI/Gui/MainWindow.cs
+++ b/LongoMatch.GUI/Gui/MainWindow.cs
@@ -50,6 +50,7 @@ namespace LongoMatch.Gui
IAnalysisWindow analysisWindow;
Project openedProject;
ProjectType projectType;
+ Widget currentPanel;
#region Constructors
public MainWindow(IGUIToolkit guiToolkit) :
@@ -75,7 +76,6 @@ namespace LongoMatch.Gui
false);
screen = Display.Default.DefaultScreen;
this.Resize(screen.Width * 80 / 100, screen.Height * 80 / 100);
- analysisWindow = new AnalysisComponent();
}
#endregion
@@ -91,11 +91,8 @@ namespace LongoMatch.Gui
if (panel == null) {
ResetGUI ();
} else {
- foreach (Widget widget in centralbox.AllChildren) {
- if (widget != welcomepanel1) {
- centralbox.Remove (widget);
- }
- }
+ RemovePanel ();
+ currentPanel = panel;
panel.Show();
if (panel is IPanel) {
(panel as IPanel).BackEvent += ResetGUI;
@@ -139,6 +136,7 @@ namespace LongoMatch.Gui
Title = Constants.SOFTWARE_NAME;
}
MakeActionsSensitive(true, projectType);
+ analysisWindow = new AnalysisComponent();
analysisWindow.SetProject (project, projectType, props, filter);
SetPanel (analysisWindow as Widget);
return analysisWindow;
@@ -147,7 +145,8 @@ namespace LongoMatch.Gui
public void CloseProject () {
openedProject = null;
projectType = ProjectType.None;
- centralbox.Remove (analysisWindow as Gtk.Widget);
+ (analysisWindow as Gtk.Widget).Destroy();
+ analysisWindow = null;
ResetGUI ();
}
@@ -209,14 +208,22 @@ namespace LongoMatch.Gui
};
}
+ void RemovePanel () {
+ if (currentPanel != null) {
+ if (currentPanel is IPanel) {
+ (currentPanel as IPanel).BackEvent -= ResetGUI;
+ }
+ currentPanel.Destroy ();
+ currentPanel.Dispose();
+ System.GC.Collect();
+ }
+ currentPanel = null;
+ }
+
private void ResetGUI() {
Title = Constants.SOFTWARE_NAME;
MakeActionsSensitive(false, projectType);
- foreach (Widget widget in centralbox.AllChildren) {
- if (widget != welcomepanel1) {
- centralbox.Remove (widget);
- }
- }
+ RemovePanel ();
welcomepanel1.Show ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]