[gbrainy] Allows to enable/disable pluging without having to quit the application



commit 542546511c798e48e2de4cf2830335c5838c81a2
Author: Jordi Mas <jmas softcatala org>
Date:   Sun Jul 3 11:55:17 2011 +0200

    Allows to enable/disable pluging without having to quit the application

 src/Clients/Classical/Dialogs/CustomGameDialog.cs |    9 +++++++++
 src/Clients/Classical/gbrainy.cs                  |    7 ++++++-
 src/Core/Main/GameManager.cs                      |    3 +--
 3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/Clients/Classical/Dialogs/CustomGameDialog.cs b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
index b639db9..001059f 100644
--- a/src/Clients/Classical/Dialogs/CustomGameDialog.cs
+++ b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
@@ -29,6 +29,7 @@ namespace gbrainy.Clients.Classical.Dialogs
 {
 	public class CustomGameDialog : BuilderDialog
 	{
+		// This is static to allow to preserve the selection in different instances
 		static ListStore games_store;
 		[GtkBeans.Builder.Object] Gtk.TreeView treeview;
 		[GtkBeans.Builder.Object] Box preview_vbox;
@@ -143,6 +144,14 @@ namespace gbrainy.Clients.Classical.Dialogs
 			get { return selection_done;}
 		}
 
+		public static void Clear ()
+		{
+			if (games_store != null)
+				games_store.Dispose ();
+
+			games_store = null;
+		}
+
 		int GameSort (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
 		{
 			string name_a, name_b;
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index f18b21a..9b2004d 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -199,7 +199,12 @@ namespace gbrainy.Clients.Classical
 				showtoolbar_menuitem.Active = false;
 
 		#if MONO_ADDINS
-			extensions_menuitem.Activated += delegate (object sender, EventArgs ar) { Mono.Addins.Gui.AddinManagerWindow.Run (app_window);};
+			extensions_menuitem.Activated += delegate (object sender, EventArgs ar) 
+			{ 
+				Mono.Addins.Gui.AddinManagerWindow.Run (app_window);
+				GameManagerPreload (session.GameManager);
+				CustomGameDialog.Clear ();
+			};
 		#else
 			extensions_menuitem.Visible = false;
 		#endif
diff --git a/src/Core/Main/GameManager.cs b/src/Core/Main/GameManager.cs
index 93f2cbf..5bfe6fa 100644
--- a/src/Core/Main/GameManager.cs
+++ b/src/Core/Main/GameManager.cs
@@ -162,7 +162,7 @@ namespace gbrainy.Core.Main
 			get { return available_games.ToArray (); }
 		}
 		
-		// Gives the Assembly.Load used in GamaManager the right path to load the application assemblies
+		// Gives the Assembly.Load used in GameManager the right path to load the application assemblies
 		static Assembly ResolveAssemblyLoad (object sender, ResolveEventArgs args)
 		{
 			IConfiguration config = ServiceLocator.Instance.GetService <IConfiguration> ();	
@@ -482,7 +482,6 @@ namespace gbrainy.Core.Main
 				}
 
 				puzzle =  (Game) Activator.CreateInstance ((Type) available_games [enumerator.Current].TypeOf, true);
-				//puzzle =  (Game) Activator.CreateInstance (LogicPuzzles [37], true);
 
 				puzzle.Variant = available_games [enumerator.Current].Variant;
 



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