diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-10-04 10:34:38 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-10-04 10:34:38 +0000 |
commit | efbcece07b3a91f4b475559997f892e24751f0e6 (patch) | |
tree | c7ee12626dbd268df4a94bd46b29f6fc7126d2d4 /apps/onplay.c | |
parent | ae75c6eb0ae9c75173ab1b06a26cad30fc5344c9 (diff) | |
download | rockbox-efbcece07b3a91f4b475559997f892e24751f0e6.tar.gz rockbox-efbcece07b3a91f4b475559997f892e24751f0e6.zip |
New setting to control the file browser start location.
Set using the menu item in folder context menus, clear in the filebrowser settings.
Can be abused to start selecting a *file* (or have a folder selected) instead of a starting inside a folder by removing the trailing / in the .cfg
This only affects the file browser when it would open in / before (on boot, or when entereing after backing out of the browser before (*not* when exited with the menu action)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28206 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index 92864f5f16..1d59b34aa4 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -1045,6 +1045,16 @@ static bool set_recdir(void) | |||
1045 | MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR), | 1045 | MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR), |
1046 | set_recdir, NULL, clipboard_callback, Icon_Recording); | 1046 | set_recdir, NULL, clipboard_callback, Icon_Recording); |
1047 | #endif | 1047 | #endif |
1048 | static bool set_startdir(void) | ||
1049 | { | ||
1050 | snprintf(global_settings.start_directory, | ||
1051 | sizeof(global_settings.start_directory), | ||
1052 | "%s/", selected_file); | ||
1053 | settings_save(); | ||
1054 | return false; | ||
1055 | } | ||
1056 | MENUITEM_FUNCTION(set_startdir_item, 0, ID2P(LANG_SET_AS_START_DIR), | ||
1057 | set_startdir, NULL, clipboard_callback, Icon_file_view_menu); | ||
1048 | 1058 | ||
1049 | static int clipboard_callback(int action,const struct menu_item_ex *this_item) | 1059 | static int clipboard_callback(int action,const struct menu_item_ex *this_item) |
1050 | { | 1060 | { |
@@ -1097,7 +1107,8 @@ static int clipboard_callback(int action,const struct menu_item_ex *this_item) | |||
1097 | else if ((selected_file_attr & ATTR_DIRECTORY)) | 1107 | else if ((selected_file_attr & ATTR_DIRECTORY)) |
1098 | { | 1108 | { |
1099 | /* only for directories */ | 1109 | /* only for directories */ |
1100 | if (this_item == &delete_dir_item | 1110 | if (this_item == &delete_dir_item || |
1111 | this_item == &set_startdir_item | ||
1101 | #ifdef HAVE_RECORDING | 1112 | #ifdef HAVE_RECORDING |
1102 | || this_item == &set_recdir_item | 1113 | || this_item == &set_recdir_item |
1103 | #endif | 1114 | #endif |
@@ -1162,7 +1173,7 @@ MAKE_ONPLAYMENU( tree_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE), | |||
1162 | #ifdef HAVE_RECORDING | 1173 | #ifdef HAVE_RECORDING |
1163 | &set_recdir_item, | 1174 | &set_recdir_item, |
1164 | #endif | 1175 | #endif |
1165 | &add_to_faves_item, | 1176 | &set_startdir_item, &add_to_faves_item, |
1166 | ); | 1177 | ); |
1167 | static int onplaymenu_callback(int action,const struct menu_item_ex *this_item) | 1178 | static int onplaymenu_callback(int action,const struct menu_item_ex *this_item) |
1168 | { | 1179 | { |