From 101693fd3047fb64e766580e80635a424fa25c4d Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 15 Nov 2011 13:22:02 +0000 Subject: FS#12251 - User shortcuts in the main menu. Custom shortcuts which give the user fast access to regularly used files/folders/settings/whatever. Thanks to Alexander Levin for the manual part of the patch git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30990 a1c6a512-1295-4272-9138-f99709370657 --- apps/onplay.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'apps/onplay.c') diff --git a/apps/onplay.c b/apps/onplay.c index aab023c846..629de93886 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -63,6 +63,7 @@ #include "pitchscreen.h" #include "viewport.h" #include "filefuncs.h" +#include "shortcuts.h" static int context; static char* selected_file = NULL; @@ -382,10 +383,13 @@ static int treeplaylist_callback(int action, return action; } -void onplay_show_playlist_menu(char* track_name) +void onplay_show_playlist_menu(char* path) { - selected_file = track_name; - selected_file_attr = FILE_ATTR_AUDIO; + selected_file = path; + if (dir_exists(path)) + selected_file_attr = ATTR_DIRECTORY; + else + selected_file_attr = filetype_get_attr(path); do_menu(&tree_playlist_menu, NULL, NULL, false); } @@ -1032,8 +1036,13 @@ MENUITEM_FUNCTION(list_viewers_item, 0, ID2P(LANG_ONPLAY_OPEN_WITH), MENUITEM_FUNCTION(properties_item, MENU_FUNC_USEPARAM, ID2P(LANG_PROPERTIES), onplay_load_plugin, (void *)"properties", clipboard_callback, Icon_NOICON); -MENUITEM_FUNCTION(add_to_faves_item, MENU_FUNC_USEPARAM, ID2P(LANG_ADD_TO_FAVES), - onplay_load_plugin, (void *)"shortcuts_append", +static bool onplay_add_to_shortcuts(void) +{ + shortcuts_add(SHORTCUT_BROWSER, selected_file); + return false; +} +MENUITEM_FUNCTION(add_to_faves_item, 0, ID2P(LANG_ADD_TO_FAVES), + onplay_add_to_shortcuts, NULL, clipboard_callback, Icon_NOICON); #if LCD_DEPTH > 1 -- cgit v1.2.3