summaryrefslogtreecommitdiffstats
path: root/apps/onplay.c
diff options
context:
space:
mode:
authorOsborne Jacobs <ozziejacks@gmail.com>2012-03-11 00:47:28 -0500
committerJonathan Gordon <rockbox@jdgordon.info>2012-03-12 08:54:02 +0100
commitfb30d013729f5dc8f256b6d5269f65e4b864d47c (patch)
tree7332e12902aa1b8cb92a4d83e61b9b23fcd34b85 /apps/onplay.c
parent16a95618de709caeca45a34f2649d6cfd6a66d5f (diff)
downloadrockbox-fb30d013729f5dc8f256b6d5269f65e4b864d47c.tar.gz
rockbox-fb30d013729f5dc8f256b6d5269f65e4b864d47c.zip
Fix minor bookmark problems/Enhance bookmark functions
This fix: -fixes when the bookmark menu and submenus are displayed and hidden in the context menu. -'Create Bookmark' should be hidden when tracks are queued in the playlist or nothing is currently playing (previously it was never hidden) -'List Bookmarks' should be hidden if and only if no bookmark file exists for the current playlist (previously it was hidden if tracks were queued or nothing was playing neither of which hinder loading bookmarks) -'Bookmarks' main menu should be hidden if both 'Create Bookmarks' and 'List Bookmarks' submenus are hidden -fixes a problem where the 'Bookmark Error' message was not always displayed on bookmarking failure -adds BOOKMARK_USB_CONNECTED return value to the bookmark functions to distinguish if the bookmark list was exited due to a USB connection. -fixes other minor logic problems in the bookmarking functions Change-Id: If6394b2e77f027773a7c94ffdcb52dbb15e2922b Reviewed-on: http://gerrit.rockbox.org/177 Reviewed-by: Osborne Jacobs <ozziejacks@gmail.com> Tested-by: Osborne Jacobs <ozziejacks@gmail.com> Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index 143745d366..11fffb9312 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -91,7 +91,8 @@ static int bookmark_menu_callback(int action,
const struct menu_item_ex *this_item);
MENUITEM_FUNCTION(bookmark_create_menu_item, 0,
ID2P(LANG_BOOKMARK_MENU_CREATE),
- bookmark_create_menu, NULL, NULL, Icon_Bookmark);
+ bookmark_create_menu, NULL,
+ bookmark_menu_callback, Icon_Bookmark);
MENUITEM_FUNCTION(bookmark_load_menu_item, 0,
ID2P(LANG_BOOKMARK_MENU_LIST),
bookmark_load_menu, NULL,
@@ -105,13 +106,20 @@ static int bookmark_menu_callback(int action,
switch (action)
{
case ACTION_REQUEST_MENUITEM:
- if (this_item == &bookmark_load_menu_item)
+ /* 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 (!bookmark_exists())
return ACTION_EXIT_MENUITEM;
}
- /* hide the bookmark menu if there is no playback */
- else if ((audio_status() & AUDIO_STATUS_PLAY) == 0)
+ /* 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;
#ifdef HAVE_LCD_CHARCELLS