banshee r3086 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Core/Hyena src/Extensions src/Extensions/Banshee.PlayQueue src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue src/Extensions/Banshee.PlayQueue/Resources



Author: abock
Date: Tue Jan 29 23:00:59 2008
New Revision: 3086
URL: http://svn.gnome.org/viewvc/banshee?rev=3086&view=rev

Log:
2008-01-29  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs:
    Make protected properties public - they should be since they are just
    wrappers to functionality that can be used via alternate API

    * src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs:
    Automatically load/unload XML UI resources and actions for the active
    source if actions and UI are set in the source properties

    * src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs:
    Do not crash if the source context menu is null

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs:
    Reset the highlight on left mouse click

    * src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
    Split the XML UI between two definitions since one needs loading/unloading
    as the active source changes (the toolbar UI)

    * src/Extensions/Banshee.PlayQueue/Resources/ActiveSourceUI.xml: UI
    for use when the play queue is the active source

    * src/Extensions/Banshee.PlayQueue/Resources/GlobalUI.xml: UI for the
    play queue to be loaded at all times



Added:
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/ActiveSourceUI.xml
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/GlobalUI.xml
Removed:
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/Actions.xml
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
   trunk/banshee/src/Core/Banshee.Services/Makefile.am
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
   trunk/banshee/src/Core/Hyena/Hyena.mdp
   trunk/banshee/src/Core/Hyena/Makefile.am
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue.mdp
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am
   trunk/banshee/src/Extensions/Extensions.mds

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	Tue Jan 29 23:00:59 2008
@@ -115,6 +115,8 @@
     <File name="Banshee.PlaybackController/IPlaybackControllerExportable.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.PlaybackController/ICanonicalPlaybackController.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.PlaybackController/IBasicPlaybackController.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Sources/IDurationAggregator.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Sources/IFileSizeAggregator.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
@@ -139,4 +141,4 @@
     <AsmRefVar />
     <ProjectRefVar />
   </MonoDevelop.Autotools.MakefileInfo>
-</Project>
+</Project>
\ No newline at end of file

Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am	Tue Jan 29 23:00:59 2008
@@ -3,7 +3,6 @@
 LINK = $(REF_BANSHEE_SERVICES)
 
 SOURCES =  \
-	$(top_srcdir)/ext/sexp-engine/src/SExpEngine/*.cs \
 	Banshee.AudioProfiles/GConfProfileConfiguration.cs \
 	Banshee.AudioProfiles/Pipeline.cs \
 	Banshee.AudioProfiles/PipelineVariable.cs \

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/BansheeActionGroup.cs	Tue Jan 29 23:00:59 2008
@@ -45,24 +45,24 @@
         {
         }
 
-        protected void UpdateActions (bool visible, bool sensitive, params string [] action_names)
+        public void UpdateActions (bool visible, bool sensitive, params string [] action_names)
         {
             UpdateActions (visible, sensitive, null, action_names);
         }
 
-        protected void UpdateActions (bool visible, bool sensitive, Source source, params string [] action_names)
+        public void UpdateActions (bool visible, bool sensitive, Source source, params string [] action_names)
         {
             foreach (string name in action_names) {
                 UpdateAction (name, visible, sensitive, source);
             }
         }
 
-        protected void UpdateAction (string action_name, bool visible, bool sensitive)
+        public void UpdateAction (string action_name, bool visible, bool sensitive)
         {
             UpdateAction (action_name, visible, sensitive, null);
         }
 
-        protected void UpdateAction (string action_name, bool visible, bool sensitive, Source source)
+        public void UpdateAction (string action_name, bool visible, bool sensitive, Source source)
         {
             Action action = this[action_name];
             action.Visible = visible;
@@ -79,7 +79,7 @@
             }
         }
 
-        protected Gtk.Window PrimaryWindow {
+        public Gtk.Window PrimaryWindow {
             get { return ServiceManager.Get<GtkElementsService> ("GtkElementsService").PrimaryWindow; }
         }
     }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/InterfaceActionService.cs	Tue Jan 29 23:00:59 2008
@@ -27,10 +27,13 @@
 //
 
 using System;
+using System.IO;
+using System.Reflection;
 using System.Collections.Generic;
 
 using Gtk;
 
+using Banshee.Sources;
 using Banshee.ServiceStack;
 
 namespace Banshee.Gui
@@ -46,6 +49,9 @@
         private TrackActions    track_actions;
         private SourceActions   source_actions;
         
+        private BansheeActionGroup active_source_actions;
+        private uint active_source_uiid = 0;
+        
         public InterfaceActionService ()
         {
             global_actions      = new GlobalActions (this);
@@ -60,7 +66,9 @@
             AddActionGroup (track_actions);
             AddActionGroup (source_actions);
 
-            ui_manager.AddUiFromResource ("core-ui-actions-layout.xml");            
+            ui_manager.AddUiFromResource ("core-ui-actions-layout.xml");    
+            
+            ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
         }
         
         private void InnerAddActionGroup (ActionGroup group)
@@ -146,6 +154,38 @@
             }
         }
         
+        private void OnActiveSourceChanged (SourceEventArgs args)
+        {
+            if (active_source_uiid > 0) {
+                ui_manager.RemoveUi (active_source_uiid);
+                active_source_uiid = 0;
+            }
+                
+            if (active_source_actions != null) {
+                RemoveActionGroup (active_source_actions.Name);
+                active_source_actions = null;
+            }
+            
+            Source active_source = ServiceManager.SourceManager.ActiveSource;
+            if (active_source == null) {
+                return;
+            }
+            
+            active_source_actions = active_source.Properties.Get<BansheeActionGroup> ("ActiveSourceActions");
+            if (active_source_actions != null) {
+                AddActionGroup (active_source_actions);
+            }
+                
+            Assembly assembly = Assembly.GetAssembly (active_source.GetType ());
+            string ui_file = active_source.Properties.GetString ("ActiveSourceUIResource");
+            
+            if (ui_file != null) {
+                using (StreamReader reader = new StreamReader (assembly.GetManifestResourceStream (ui_file))) {
+                    active_source_uiid = ui_manager.AddUiFromString (reader.ReadToEnd ());
+                }
+            }
+        }
+        
         public Action this[string actionId] {
             get { return FindAction (actionId); }
         }
@@ -154,7 +194,7 @@
             get { return ui_manager; }
         }
         
-        public ActionGroup GlobalActions {
+        public GlobalActions GlobalActions {
             get { return global_actions; }
         }
         

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	Tue Jan 29 23:00:59 2008
@@ -154,6 +154,10 @@
 
             string path = SourceView.HighlightedSource.Properties.GetString ("GtkActionPath") ?? "/SourceContextMenu";
             Gtk.Menu menu = action_service.UIManager.GetWidget (path) as Menu;
+            if (menu == null) {
+                return;
+            }
+
             menu.Show (); 
             menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime);
             menu.SelectionDone += delegate { SourceView.ResetHighlight (); };

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs	Tue Jan 29 23:00:59 2008
@@ -295,6 +295,10 @@
         {
             TreePath path;
             
+            if (evnt.Button == 1) {
+                ResetHighlight ();
+            }
+            
             if(!GetPathAtPos((int)evnt.X, (int)evnt.Y, out path)) {
                 return true;
             }

Modified: trunk/banshee/src/Core/Hyena/Hyena.mdp
==============================================================================
--- trunk/banshee/src/Core/Hyena/Hyena.mdp	(original)
+++ trunk/banshee/src/Core/Hyena/Hyena.mdp	Tue Jan 29 23:00:59 2008
@@ -71,6 +71,8 @@
     <File name="Hyena.SExpEngine/StringFunctionSet.cs" subtype="Code" buildaction="Compile" />
     <File name="Hyena.SExpEngine/TreeNode.cs" subtype="Code" buildaction="Compile" />
     <File name="Hyena.SExpEngine/UtilityFunctionSet.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hyena.Data/ArrayModelCache.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hyena.Data/DictionaryModelCache.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Modified: trunk/banshee/src/Core/Hyena/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Hyena/Makefile.am	(original)
+++ trunk/banshee/src/Core/Hyena/Makefile.am	Tue Jan 29 23:00:59 2008
@@ -10,7 +10,6 @@
 	Hyena.CommandLine/CommandLineParser.cs \
 	Hyena.CommandLine/Layout.cs \
 	Hyena.CommandLine/LayoutGroup.cs \
-	Hyena.CommandLine/LayoutGroupAttribute.cs \
 	Hyena.CommandLine/LayoutOption.cs \
 	Hyena.Data.Query/DateQueryValue.cs \
 	Hyena.Data.Query/FileSizeQueryValue.cs \
@@ -35,8 +34,8 @@
 	Hyena.Data.Sqlite/SqliteModelCache.cs \
 	Hyena.Data.Sqlite/SqliteModelProvider.cs \
 	Hyena.Data/ArrayModelCache.cs \
-	Hyena.Data/DictionaryModelCache.cs \
 	Hyena.Data/ColumnDescription.cs \
+	Hyena.Data/DictionaryModelCache.cs \
 	Hyena.Data/ICacheableModel.cs \
 	Hyena.Data/ICareAboutView.cs \
 	Hyena.Data/IFilterable.cs \

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue.mdp	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue.mdp	Tue Jan 29 23:00:59 2008
@@ -10,7 +10,8 @@
   <Contents>
     <File name="Banshee.PlayQueue/PlayQueueSource.cs" subtype="Code" buildaction="Compile" />
     <File name="Resources/Banshee.PlayQueue.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="Resources/Actions.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/ActiveSourceUI.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/GlobalUI.xml" subtype="Code" buildaction="EmbedAsResource" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	Tue Jan 29 23:00:59 2008
@@ -51,6 +51,8 @@
         private static string special_playlist_name = typeof (PlayQueueSource).ToString ();
 
         private LibraryTrackInfo playing_track;
+        private BansheeActionGroup actions;
+        private bool actions_loaded = false;
         
         public PlayQueueSource () : base (Catalog.GetString ("Play Queue"), null)
         {
@@ -59,7 +61,6 @@
             Order = 0;
             Properties.SetString ("IconName", "audio-x-generic");
             Properties.SetString ("RemoveTracksActionLabel", Catalog.GetString ("Remove From Play Queue"));
-            Properties.SetString ("GtkActionPath", "/PlayQueueContextMenu");
             
             ((TrackListDatabaseModel)TrackModel).ForcedSortQuery = "CorePlaylistEntries.EntryID ASC";
             
@@ -69,7 +70,6 @@
             ServiceManager.SourceManager.AddSource (this);
             
             InterfaceActionService uia_service = ServiceManager.Get<InterfaceActionService> ();
-            uia_service.UIManager.AddUiFromResource ("Actions.xml");
             uia_service.TrackActions.Add (new ActionEntry [] {
                 new ActionEntry ("AddToPlayQueueAction", Stock.Add,
                     Catalog.GetString ("Add to Play Queue"), null,
@@ -77,6 +77,7 @@
                     OnAddToPlayQueue)
             });
             
+            actions = new BansheeActionGroup ("PlayQueueSource");
             uia_service.GlobalActions.Add (new ActionEntry [] {
                 new ActionEntry ("ClearPlayQueueAction", Stock.Clear,
                     Catalog.GetString ("Clear Play Queue"), null,
@@ -84,8 +85,14 @@
                     OnClearPlayQueue)
             });
             
-            UpdateActions ();
+            uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
+            
+            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
+            Properties.SetString ("GtkActionPath", "/PlayQueueContextMenu");
             
+            actions_loaded = true;
+            
+            UpdateActions ();
             ServiceManager.SourceManager.ActiveSourceChanged += delegate { UpdateActions (); };
         }
         
@@ -108,7 +115,10 @@
         
         protected override void OnUpdated ()
         {
-            UpdateActions ();
+            if (actions_loaded) {
+                UpdateActions ();
+            }
+            
             base.OnUpdated ();
         }
         
@@ -138,24 +148,15 @@
         }
         
         private void UpdateActions ()
-        {
+        {   
             InterfaceActionService uia_service = ServiceManager.Get <InterfaceActionService> ();
             if (uia_service == null) {
                 return;
             }
             
-            Source source = ServiceManager.SourceManager.ActiveSource;
-            
-            Action clear_action = uia_service.GlobalActions["ClearPlayQueueAction"]; 
-            if (clear_action != null) {
-                clear_action.Visible = ServiceManager.SourceManager.ActiveSource == this;
-                clear_action.Sensitive = Count > 0;
-            }
-            
-            Action add_to_queue_action = uia_service.TrackActions["AddToPlayQueueAction"];
-            if (add_to_queue_action != null) {
-                add_to_queue_action.Visible = ServiceManager.SourceManager.ActiveSource != this;
-            }
+            uia_service.GlobalActions.UpdateAction ("ClearPlayQueueAction", true, Count > 0);
+            uia_service.TrackActions.UpdateAction ("AddToPlayQueueAction", 
+                ServiceManager.SourceManager.ActiveSource != this, true);
         }
         
         void IBasicPlaybackController.First ()

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Makefile.am	Tue Jan 29 23:00:59 2008
@@ -2,12 +2,12 @@
 TARGET = library
 LINK = $(REF_EXTENSION_PLAYQUEUE)
 
-SOURCES =  \
-	Banshee.PlayQueue/PlayQueueSource.cs 
+SOURCES = Banshee.PlayQueue/PlayQueueSource.cs 
 
 RESOURCES =  \
-	Resources/Actions.xml \
-	Resources/Banshee.PlayQueue.addin.xml
+	Resources/ActiveSourceUI.xml \
+	Resources/Banshee.PlayQueue.addin.xml \
+	Resources/GlobalUI.xml
 
 include $(top_srcdir)/build/build.mk
 

Added: trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/ActiveSourceUI.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/ActiveSourceUI.xml	Tue Jan 29 23:00:59 2008
@@ -0,0 +1,7 @@
+<ui>
+    <toolbar name="HeaderToolbar">
+        <placeholder name="SourceActions">
+            <toolitem action="ClearPlayQueueAction" />
+        </placeholder>
+    </toolbar>
+</ui>

Added: trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/GlobalUI.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/GlobalUI.xml	Tue Jan 29 23:00:59 2008
@@ -0,0 +1,10 @@
+<ui>
+    <popup name="PlayQueueContextMenu">
+        <menuitem action="ClearPlayQueueAction"></menuitem>
+    </popup>
+    <popup name="TrackContextMenu" action="TrackContextMenuAction">
+        <placeholder name="AboveAddToPlaylist">
+            <menuitem name="AddToPlayQueue" action="AddToPlayQueueAction"></menuitem>
+        </placeholder>
+    </popup>
+</ui>
\ No newline at end of file

Modified: trunk/banshee/src/Extensions/Extensions.mds
==============================================================================
--- trunk/banshee/src/Extensions/Extensions.mds	(original)
+++ trunk/banshee/src/Extensions/Extensions.mds	Tue Jan 29 23:00:59 2008
@@ -14,4 +14,4 @@
     <Entry filename="Banshee.MultimediaKeys/Banshee.MultimediaKeys.mdp" />
     <Entry filename="Banshee.PlayQueue/Banshee.PlayQueue.mdp" />
   </Entries>
-</Combine>
+</Combine>
\ No newline at end of file



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