From a800226cd4c0cb26695eb212688ac88dbe3c9c57 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Mon, 18 May 2015 00:04:04 +0200 Subject: [PATCH] status: always replace song, but deselect only when path changes --- src/status.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/status.cpp b/src/status.cpp index 57de236..bb42e4b 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -427,23 +427,19 @@ void Status::Changes::playlist(unsigned previous_version) for (; s != end; ++s) { size_t pos = s->getPosition(); + myPlaylist->registerSong(*s); if (pos < myPlaylist->main().size()) { // if song's already in playlist, replace it with a new one MPD::Song &old_s = myPlaylist->main()[pos].value(); + myPlaylist->unregisterSong(old_s); + // remove selection only if the path is different if (old_s != *s) - { - myPlaylist->registerSong(*s); - myPlaylist->unregisterSong(old_s); myPlaylist->main()[pos].setSelected(false); - old_s = std::move(*s); - } + old_s = std::move(*s); } else // otherwise just add it to playlist - { - myPlaylist->registerSong(*s); myPlaylist->main().addItem(std::move(*s)); - } } myPlaylist->reloadTotalLength(); -- 2.11.4.GIT