From 1dcebeace1b317df49ce4589a931a4c05a6e9fbc Mon Sep 17 00:00:00 2001 From: Henrik Friedrichsen Date: Sat, 22 Oct 2022 14:20:43 +0200 Subject: [PATCH] Add "save/unsave album" to context menu Fixes #964 --- README.md | 4 ++-- src/ui/contextmenu.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 74271d2..8e2a06b 100644 --- a/README.md +++ b/README.md @@ -217,8 +217,8 @@ playback depending on your desktop environment settings. Have a look at the | Space | Queue track or playlist. | | . | Play the selected item after the currently playing track. | | P | Move to the currently playing track in the queue. | -| S | Save the currently playing track to your library. | -| D | Remove the currently playing track from your library. | +| S | Save the currently playing item to your library. | +| D | Remove the currently playing item from your library. | | Shift+P | Toggle playback (i.e. Play/Pause). | | Shift+S | Stop playback. | | Shift+U | Update the library cache (tracks, artists, albums, playlists). | diff --git a/src/ui/contextmenu.rs b/src/ui/contextmenu.rs index 5538de8..601dda8 100644 --- a/src/ui/contextmenu.rs +++ b/src/ui/contextmenu.rs @@ -276,6 +276,18 @@ impl ContextMenu { ); } + if let Some(album) = item.album(queue.clone()) { + if let Some(savestatus) = album.is_saved(library.clone()) { + content.add_item( + match savestatus { + true => "Unsave album", + false => "Save album", + }, + ContextMenuAction::ToggleSavedStatus(album.as_listitem()), + ); + } + } + // open detail view of artist/album { let library = library.clone();