From ef1e7d88963aa411f06448f10b3b63886c157c9c Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 26 May 2024 19:13:55 +0200 Subject: bookmarks: show 'Create Bookmark' for unsaved playlists Instead of hiding this option when the current playlist is unsaved, we can offer to save the playlist, if necessary, before attempting to create a bookmark. This simplifies the workflow by getting rid of steps 1 and 2 that a user currently needs to perform: 1) Open context menu, check if "Create Bookmark" option is available 2) If not: Re-open context menu. Select Current Playlist -> Save Current Playlist 3) Re-open context menu. Select Bookmarks -> Create Bookmark Change-Id: Ia9fb5f9db95e2fcbde03470a3c3745824424a339 --- apps/bookmark.c | 4 ++++ apps/onplay.c | 11 +---------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'apps') diff --git a/apps/bookmark.c b/apps/bookmark.c index 3087b7302b..08f63469aa 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -42,6 +42,7 @@ #include "plugin.h" #include "file.h" #include "pathfuncs.h" +#include "playlist_menu.h" /*#define LOGF_ENABLE*/ #include "logf.h" @@ -1096,6 +1097,9 @@ static bool play_bookmark(const char* bookmark) /* ----------------------------------------------------------------------- */ bool bookmark_create_menu(void) { + if (!bookmark_is_bookmarkable_state()) + save_playlist_screen(NULL); + return write_bookmark(true); } /* ----------------------------------------------------------------------- */ diff --git a/apps/onplay.c b/apps/onplay.c index 71f902900d..2a2ac16b04 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -177,21 +177,12 @@ static int bookmark_menu_callback(int action, switch (action) { case ACTION_REQUEST_MENUITEM: - /* hide create bookmark option if bookmarking isn't currently possible (no track playing, queued tracks...) */ - if (this_item == &bookmark_create_menu_item) - { - if (!bookmark_is_bookmarkable_state()) - return ACTION_EXIT_MENUITEM; - } /* hide loading bookmarks menu if no bookmarks exist */ - else if (this_item == &bookmark_load_menu_item) + if (this_item == &bookmark_load_menu_item) { if (!bookmark_exists()) return ACTION_EXIT_MENUITEM; } - /* hide the bookmark menu if bookmarks can't be loaded or created */ - else if (!bookmark_is_bookmarkable_state() && !bookmark_exists()) - return ACTION_EXIT_MENUITEM; break; case ACTION_EXIT_MENUITEM: settings_save(); -- cgit v1.2.3