[banshee] [Muinshee] Hide previous songs



commit 1978a5fcc4edc42e4dc9eefe05467859bff8c39f
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Sun Mar 7 17:39:30 2010 +1100

    [Muinshee] Hide previous songs

 src/Clients/Muinshee/Muinshee/PlayerInterface.cs   |   13 +++++++++++++
 .../Banshee.PlayQueue/PlayQueueSource.cs           |    4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/Clients/Muinshee/Muinshee/PlayerInterface.cs b/src/Clients/Muinshee/Muinshee/PlayerInterface.cs
index 4ccebda..a2e6c2a 100644
--- a/src/Clients/Muinshee/Muinshee/PlayerInterface.cs
+++ b/src/Clients/Muinshee/Muinshee/PlayerInterface.cs
@@ -44,6 +44,7 @@ using Banshee.Collection;
 using Banshee.Collection.Database;
 using Banshee.MediaEngine;
 using Banshee.Configuration;
+using Banshee.Preferences;
 
 using Banshee.Gui;
 using Banshee.Gui.Widgets;
@@ -69,6 +70,9 @@ namespace Muinshee
         private TerseTrackListView track_view;
         private Label list_label;
 
+        private int played_songs_number = -1;
+        private SchemaPreference<int> played_songs_number_pref;
+
         public PlayerInterface () : base (Catalog.GetString ("Banshee Media Player"), "muinshee", -1, 450)
         {
         }
@@ -97,6 +101,12 @@ namespace Muinshee
         {
             if (actions == null) {
                 play_queue.Populate = false;
+                played_songs_number = PlayQueueSource.PlayedSongsNumberSchema.Get ();
+                var service = ServiceManager.Get<PreferenceService> ();
+                var section = service["source-specific"].ChildPages[play_queue.PreferencesPageId][null];
+                played_songs_number_pref = (SchemaPreference<int>) section[PlayQueueSource.PlayedSongsNumberSchema.Key];
+                played_songs_number_pref.Value = 0;
+
                 actions = new MuinsheeActions (play_queue);
                 actions.Actions.AddActionGroup (actions);
                 ServiceManager.SourceManager.SetActiveSource (play_queue);
@@ -117,6 +127,9 @@ namespace Muinshee
         {
             lock (this) {
                 Hide ();
+                if (played_songs_number >= 0) {
+                    played_songs_number_pref.Value = played_songs_number;
+                }
                 if (actions != null) {
                     actions.Dispose ();
                 }
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
index e58a36e..641d9da 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
@@ -93,8 +93,6 @@ namespace Banshee.PlayQueue
             ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent);
             ServiceManager.PlaybackController.TrackStarted += OnTrackStarted;
 
-            ServiceManager.SourceManager.AddSource (this);
-
             // TODO change this Gtk.Action code so that the actions can be removed.  And so this
             // class doesn't depend on Gtk/ThickClient.
             actions = new PlayQueueActions (this);
@@ -123,6 +121,8 @@ namespace Banshee.PlayQueue
                     SELECT MAX(ViewOrder) + 1
                     FROM CorePlaylistEntries
                     WHERE PlaylistID = ?", DbId));
+
+            ServiceManager.SourceManager.AddSource (this);
         }
 
         protected override void Initialize ()



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