[banshee] Dap: better check for the playing track before ejecting (bgo#658142)



commit ba835711dd48e704709f9e0aeba491c3bfc19469
Author: Nicholas Little <arealityfarbetween googlemail com>
Date:   Sat Jan 19 14:13:41 2013 +0000

    Dap: better check for the playing track before ejecting (bgo#658142)
    
    Before ejecting the device, there is some logic to stop playback
    if the track that is currently playing is inside the device that
    the user wants to eject. This logic was not taking in account that
    this track can still be inside the device even if it's not playing
    from the current DapSource (i.e. it can be in FileSystemQueue source).
    
    For these cases, we check simply the path of the track now to see
    if it starts with the BaseDirectory of the source.
    
    Signed-off-by: Andres G. Aragoneses <knocte gmail com>

 src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs b/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
index 940bc8c..069a7a1 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
@@ -101,8 +101,11 @@ namespace Banshee.Dap
         public bool Unmap ()
         {
             DatabaseTrackInfo track = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo;
-            if (track != null && track.PrimarySourceId == this.DbId) {
-                ServiceManager.PlayerEngine.Close ();
+            if (track != null) {
+                if (track.PrimarySourceId == this.DbId ||
+                    (!String.IsNullOrEmpty (BaseDirectory) && track.LocalPath.StartsWith (BaseDirectory))) {
+                    ServiceManager.PlayerEngine.Close ();
+                }
             }
 
             SetStatus (String.Format (Catalog.GetString ("Disconnecting {0}..."), GenericName), false);



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