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
This commit is contained in:
Christian Soffke 2024-05-26 19:13:55 +02:00
parent d1aeb7db9d
commit ef1e7d8896
5 changed files with 13 additions and 20 deletions

View file

@ -42,6 +42,7 @@
#include "plugin.h" #include "plugin.h"
#include "file.h" #include "file.h"
#include "pathfuncs.h" #include "pathfuncs.h"
#include "playlist_menu.h"
/*#define LOGF_ENABLE*/ /*#define LOGF_ENABLE*/
#include "logf.h" #include "logf.h"
@ -1096,6 +1097,9 @@ static bool play_bookmark(const char* bookmark)
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
bool bookmark_create_menu(void) bool bookmark_create_menu(void)
{ {
if (!bookmark_is_bookmarkable_state())
save_playlist_screen(NULL);
return write_bookmark(true); return write_bookmark(true);
} }
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */

View file

@ -177,21 +177,12 @@ static int bookmark_menu_callback(int action,
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: 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 */ /* 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()) if (!bookmark_exists())
return ACTION_EXIT_MENUITEM; 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; break;
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
settings_save(); settings_save();

View file

@ -14,11 +14,9 @@
the bookmark to load. There are other ways to load a bookmarks mentioned the bookmark to load. There are other ways to load a bookmarks mentioned
below. below.
\note{Bookmarking does not work with dynamic (i.e. modified but not saved) \note{If the current playlist has been modified or is unsaved, such as when
playlists, such as when playing tracks from the \setting{Database} instead of playing tracks from the \setting{Database}, Rockbox will automatically
the \setting{File Browser}. offer to save the playlist to a file when you attempt to create a bookmark.
If you do not see the option to create a bookmark in the \setting{WPS Context Menu},
try saving the current playlist first.
Queued tracks (see \reference{ref:queuing}) do not get saved to the playlist file. Queued tracks (see \reference{ref:queuing}) do not get saved to the playlist file.
You're asked to confirm their removal when saving, so that the current playlist You're asked to confirm their removal when saving, so that the current playlist
can be bookmarked. } can be bookmarked. }

View file

@ -53,9 +53,9 @@ If the \setting{Save a list of recently created bookmarks} option is enabled
then you can view a list of several recent bookmarks here and select one to then you can view a list of several recent bookmarks here and select one to
jump straight to that track.\\* jump straight to that track.\\*
\note{A track launched from the file browser can be bookmarked as is. If \note{A track launched from the file browser can be bookmarked as-is. For
tracks are launched via the database, or the current playlist has been modified, tracks launched via the database, or for modified playlists, you're
creating a bookmark requires that you save the playlist first.\\*} asked to save the playlist to a file when creating a bookmark.\\*}
\begin{btnmap} \begin{btnmap}
\ActionStdNext \ActionStdNext

View file

@ -226,8 +226,8 @@ browser. The value wraps at 10.
\subsubsection{\label{ref:createbookmark}Bookmarks} \subsubsection{\label{ref:createbookmark}Bookmarks}
Create a bookmark in the currently playing track, or display existing entries. Create a bookmark in the currently playing track, or display existing entries.
Bookmarks can only be used with directories, or playlists stored on Bookmarks can only be used with directories, or playlists stored on
disk. If you don't see the option to create a bookmark, try saving the disk. You'll be asked to provide the name for a file to save the playlist to,
current playlist first. if necessary.
\note{If you've enabled options for queuing tracks (see \reference{ref:queuing}), keep \note{If you've enabled options for queuing tracks (see \reference{ref:queuing}), keep
in mind that those are not saved to a playlist file. in mind that those are not saved to a playlist file.