[banshee] [Gui] Auto add/remove ActiveSourceUIString UI



commit ff1cdeff777df8f6f02c8dc272a8ae4685c6a85e
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sun Aug 15 15:50:40 2010 -0700

    [Gui] Auto add/remove ActiveSourceUIString UI

 .../Banshee.Gui/InterfaceActionService.cs          |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
index 41359da..085e33e 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
@@ -54,7 +54,7 @@ namespace Banshee.Gui
         private SourceActions   source_actions;
 
         private BansheeActionGroup active_source_actions;
-        private uint active_source_uiid = 0;
+        private List<uint> active_source_uis = new List<uint> ();
 
         public InterfaceActionService ()
         {
@@ -82,10 +82,12 @@ namespace Banshee.Gui
 
         private void OnActiveSourceChangedGui ()
         {
-            if (active_source_uiid > 0) {
-                UIManager.RemoveUi (active_source_uiid);
-                active_source_uiid = 0;
+            foreach (uint ui_id in active_source_uis) {
+                if (ui_id != 0) {
+                    UIManager.RemoveUi (ui_id);
+                }
             }
+            active_source_uis.Clear ();
 
             if (active_source_actions != null) {
                 RemoveActionGroup (active_source_actions.Name);
@@ -104,11 +106,14 @@ namespace Banshee.Gui
                 AddActionGroup (active_source_actions);
             }
 
-            Assembly assembly =
-                active_source.GetProperty<Assembly> ("ActiveSourceUIResource.Assembly", propagate) ??
+            Assembly assembly = active_source.GetProperty<Assembly> ("ActiveSourceUIResource.Assembly", propagate) ??
                 Assembly.GetAssembly (active_source.GetType ());
+            active_source_uis.Add (AddUiFromFile (active_source.GetProperty<string> ("ActiveSourceUIResource", propagate), assembly));
 
-            active_source_uiid = AddUiFromFile (active_source.GetProperty<string> ("ActiveSourceUIResource", propagate), assembly);
+            var ui_str = active_source.GetProperty<string> ("ActiveSourceUIString", propagate);
+            if (ui_str != null) {
+                active_source_uis.Add (UIManager.AddUiFromString (ui_str));
+            }
         }
 
         private void OnExtensionChanged (object o, ExtensionNodeEventArgs args)



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