banshee r4679 - in trunk/banshee: . src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue



Author: gburt
Date: Thu Oct  9 19:37:21 2008
New Revision: 4679
URL: http://svn.gnome.org/viewvc/banshee?rev=4679&view=rev

Log:
2008-10-09  Gabriel Burt  <gabriel burt gmail com>

	* src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
	When finished playing from the play queue, don't play from the prior
	source if it wasn't playing when the play queue took over.  Partially
	fixes BGO #547213.



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs

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	Thu Oct  9 19:37:21 2008
@@ -53,6 +53,7 @@
         private ITrackModelSource prior_playback_source;
         private DatabaseTrackInfo playing_track;
         private PlayQueueActions actions;
+        private bool was_playing = false;
         
         protected override bool HasArtistAlbum {
             get { return false; }
@@ -128,7 +129,7 @@
         
         private void SetAsPlaybackSourceUnlessPlaying ()
         {
-            if (Count > 0) {
+            if (Count > 0 && ServiceManager.PlaybackController.Source != this) {
                 PriorSource = ServiceManager.PlaybackController.Source;
                 ServiceManager.PlaybackController.NextSource = this;
             }
@@ -187,7 +188,9 @@
         private void OnPlayerEvent (PlayerEventArgs args)
         {
             if (args.Event == PlayerEvent.EndOfStream) {
-                RemovePlayingTrack ();
+                if (RemovePlayingTrack () && !was_playing) {
+                    ServiceManager.PlaybackController.StopWhenFinished = true;
+                }
             } else if (args.Event == PlayerEvent.StartOfStream) {
                 if (this == ServiceManager.PlaybackController.Source) {
                     playing_track = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo; 
@@ -208,7 +211,11 @@
             
             if (Count == 0) {
                 ServiceManager.PlaybackController.Source = PriorSource;
-                ServiceManager.PlaybackController.Next (restart);
+                if (was_playing) {
+                    ServiceManager.PlaybackController.Next (restart);
+                } else {
+                    ServiceManager.PlayerEngine.Close ();
+                }
                 return true;
             }
             
@@ -221,12 +228,14 @@
             return true;
         }
         
-        private void RemovePlayingTrack ()
+        private bool RemovePlayingTrack ()
         {
             if (playing_track != null) {
                 RemoveTrack (playing_track);
                 playing_track = null;
+                return true;
             }
+            return false;
         }
         
         private ITrackModelSource PriorSource {
@@ -241,6 +250,7 @@
                     return;
                 }
                 prior_playback_source = value;
+                was_playing = ServiceManager.PlayerEngine.IsPlaying ();
             }
         }
         



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