changeset 3383:e2e875f3d02b trunk

Make playlist_load_ins handle the case when playlist is not the currently active one
author Kieran Clancy <clancy.kieran+audacious@gmail.com>
date Sun, 26 Aug 2007 07:23:52 +0930
parents 880eea081363
children d09fc992783d
files src/audacious/playlist.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Sun Aug 26 07:22:11 2007 +0930
+++ b/src/audacious/playlist.c	Sun Aug 26 07:23:52 2007 +0930
@@ -1739,6 +1739,7 @@
 playlist_load_ins(Playlist * playlist, const gchar * filename, gint pos)
 {
     PlaylistContainer *plc;
+    GList *old_iter;
     gchar *ext;
     gint old_len, new_len;
     
@@ -1752,7 +1753,16 @@
     g_return_val_if_fail(plc->plc_read != NULL, 0);
 
     old_len = playlist_get_length(playlist);
-    plc->plc_read(filename, pos);
+    /* make sure it adds files to the right playlist */
+    if (playlist != playlist_get_active()) {
+        old_iter = playlists_iter;
+        playlists_iter = g_list_find(playlists, playlist);
+        if (!playlists_iter) playlists_iter = playlists;
+        plc->plc_read(filename, pos);
+        playlists_iter = old_iter;
+    } else {
+        plc->plc_read(filename, pos);
+    }
     new_len = playlist_get_length(playlist);
 
     playlist_generate_shuffle_list(playlist);