mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 20:34:39 +01:00
Delete a playlist when unstaring it from the left 'Playlists' panel and when it's not opened
This commit is contained in:
parent
cee18eebb2
commit
a5e6c3273c
@ -254,10 +254,18 @@ void PlaylistManager::Rename(int id, const QString& new_name) {
|
||||
}
|
||||
|
||||
void PlaylistManager::Favorite(int id, bool favorite) {
|
||||
Q_ASSERT(playlists_.contains(id));
|
||||
|
||||
playlist_backend_->FavoritePlaylist(id, favorite);
|
||||
playlists_[id].p->set_favorite(favorite);
|
||||
if (playlists_.contains(id)) {
|
||||
// If playlists_ contains this playlist, its means it's opened: star or unstar it.
|
||||
playlist_backend_->FavoritePlaylist(id, favorite);
|
||||
playlists_[id].p->set_favorite(favorite);
|
||||
} else {
|
||||
Q_ASSERT(!favorite);
|
||||
// Otherwise it means user wants to remove this playlist from the left panel,
|
||||
// while it's not visible in the playlist tabbar either, because it has been
|
||||
// closed: delete it.
|
||||
playlist_backend_->RemovePlaylist(id);
|
||||
}
|
||||
emit PlaylistFavorited(id, favorite);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user