[banshee] FileSystemQueueSource: Reload when tracks are imported (bgo#634063)



commit e82143cda8b375499abc966df84966c16976ffb1
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat May 19 20:33:02 2012 +0200

    FileSystemQueueSource: Reload when tracks are imported (bgo#634063)
    
    When you drag'n'drop tracks from the FSQ to the music library, they are
    imported and are not in the FSQ anymore. But the FSQ was not refreshed,
    so they still appeared there, and clearing the FSQ would delete them
    from the library.
    
    Make sure the FSQ is refreshed when tracks are imported, so that the
    content of the FSQ is always up-to-date.

 .../FileSystemQueueSource.cs                       |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs b/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
index 9044b30..386d1b2 100644
--- a/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
+++ b/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
@@ -112,6 +112,9 @@ namespace Banshee.FileSystemQueue
             }
 
             StorageName = null;
+
+            // MusicLibrary source is initialized before extension sources
+            ServiceManager.SourceManager.MusicLibrary.TracksAdded += OnTracksImported;
         }
 
         public void Enqueue (string path)
@@ -207,6 +210,7 @@ namespace Banshee.FileSystemQueue
         public override void Dispose ()
         {
             ServiceManager.Get<DBusCommandService> ().ArgumentPushed -= OnCommandLineArgument;
+            ServiceManager.SourceManager.MusicLibrary.TracksAdded -= OnTracksImported;
             if (ClearOnQuitSchema.Get ()) {
                 OnClearFileSystemQueue (this, EventArgs.Empty);
             }
@@ -261,6 +265,14 @@ namespace Banshee.FileSystemQueue
             }
         }
 
+        private void OnTracksImported (Source sender, TrackEventArgs args)
+        {
+            if (Count > 0) {
+                // Imported tracks might have come from the FSQ, so refresh it
+                Reload ();
+            }
+        }
+
         private void OnClearFileSystemQueue (object o, EventArgs args)
         {
             // Delete any child playlists



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