diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-03-11 10:43:53 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-03-11 10:43:53 +0000 |
| commit | 642cce2e338cc6ff772c827e825205bddbc2d9be (patch) | |
| tree | bec2fdab7b207a6fabc175f353087c83e681a223 /apps/onplay.c | |
| parent | 5c8e82e097272d46caf139eda5bab58d2cbac9a0 (diff) | |
| download | rockbox-642cce2e338cc6ff772c827e825205bddbc2d9be.zip rockbox-642cce2e338cc6ff772c827e825205bddbc2d9be.tar.gz rockbox-642cce2e338cc6ff772c827e825205bddbc2d9be.tar.bz2 rockbox-642cce2e338cc6ff772c827e825205bddbc2d9be.tar.xz | |
Moved Create Directory to the ON+Play menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4360 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/onplay.c')
| -rw-r--r-- | apps/onplay.c | 83 |
1 files changed, 59 insertions, 24 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index 2f0ee3b..52d5d20 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -507,6 +507,34 @@ static bool vbr_fix(void) return false; } +bool create_dir(void) +{ + char dirname[MAX_PATH]; + char *cwd; + int rc; + int pathlen; + + cwd = getcwd(NULL, 0); + memset(dirname, 0, sizeof dirname); + + snprintf(dirname, sizeof dirname, "%s/", + cwd[1] ? cwd : ""); + + pathlen = strlen(dirname); + rc = kbd_input(dirname + pathlen, (sizeof dirname)-pathlen); + if(rc < 0) + return false; + + rc = mkdir(dirname, 0); + if(rc < 0) { + splash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED)); + } else { + onplay_result = ONPLAY_RELOAD_DIR; + } + + return true; +} + int onplay(char* file, int attr) { struct menu_items menu[5]; /* increase this if you add entries! */ @@ -514,36 +542,43 @@ int onplay(char* file, int attr) onplay_result = ONPLAY_OK; - selected_file = file; - selected_file_attr = attr; - - if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || - (attr & ATTR_DIRECTORY) || - ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) + if(file) { - menu[i].desc = str(LANG_PLAYINDICES_PLAYLIST); - menu[i].function = playlist_options; + selected_file = file; + selected_file_attr = attr; + + if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || + (attr & ATTR_DIRECTORY) || + ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) + { + menu[i].desc = str(LANG_PLAYINDICES_PLAYLIST); + menu[i].function = playlist_options; + i++; + } + + menu[i].desc = str(LANG_RENAME); + menu[i].function = rename_file; i++; + + if (!(attr & ATTR_DIRECTORY)) + { + menu[i].desc = str(LANG_DELETE); + menu[i].function = delete_file; + i++; + } + + if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) + { + menu[i].desc = str(LANG_VBRFIX); + menu[i].function = vbr_fix; + i++; + } } - menu[i].desc = str(LANG_RENAME); - menu[i].function = rename_file; + menu[i].desc = str(LANG_CREATE_DIR); + menu[i].function = create_dir; i++; - if (!(attr & ATTR_DIRECTORY)) - { - menu[i].desc = str(LANG_DELETE); - menu[i].function = delete_file; - i++; - } - - if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) - { - menu[i].desc = str(LANG_VBRFIX); - menu[i].function = vbr_fix; - i++; - } - /* DIY menu handling, since we want to exit after selection */ m = menu_init( menu, i ); result = menu_show(m); |