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 | |
parent | 5c8e82e097272d46caf139eda5bab58d2cbac9a0 (diff) | |
download | rockbox-642cce2e338cc6ff772c827e825205bddbc2d9be.tar.gz rockbox-642cce2e338cc6ff772c827e825205bddbc2d9be.zip |
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')
-rw-r--r-- | apps/main_menu.c | 5 | ||||
-rw-r--r-- | apps/onplay.c | 83 | ||||
-rw-r--r-- | apps/tree.c | 44 | ||||
-rw-r--r-- | apps/tree.h | 1 |
4 files changed, 71 insertions, 62 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c index b6d73ab6f2..23af8d7817 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -304,7 +304,7 @@ bool main_menu(void) | |||
304 | int i = 0; | 304 | int i = 0; |
305 | 305 | ||
306 | /* main menu */ | 306 | /* main menu */ |
307 | struct menu_items items[9]; | 307 | struct menu_items items[8]; |
308 | 308 | ||
309 | items[i].desc = str(LANG_BOOKMARK_MENU); | 309 | items[i].desc = str(LANG_BOOKMARK_MENU); |
310 | items[i++].function = bookmark_menu; | 310 | items[i++].function = bookmark_menu; |
@@ -336,9 +336,6 @@ bool main_menu(void) | |||
336 | items[i].desc = str(LANG_INFO); | 336 | items[i].desc = str(LANG_INFO); |
337 | items[i++].function = info_menu; | 337 | items[i++].function = info_menu; |
338 | 338 | ||
339 | items[i].desc = str(LANG_CREATE_DIR); | ||
340 | items[i++].function = create_dir; | ||
341 | |||
342 | m=menu_init( items, i ); | 339 | m=menu_init( items, i ); |
343 | #ifdef HAVE_LCD_CHARCELLS | 340 | #ifdef HAVE_LCD_CHARCELLS |
344 | status_set_param(true); | 341 | status_set_param(true); |
diff --git a/apps/onplay.c b/apps/onplay.c index 2f0ee3b861..52d5d20c6e 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -507,6 +507,34 @@ static bool vbr_fix(void) | |||
507 | return false; | 507 | return false; |
508 | } | 508 | } |
509 | 509 | ||
510 | bool create_dir(void) | ||
511 | { | ||
512 | char dirname[MAX_PATH]; | ||
513 | char *cwd; | ||
514 | int rc; | ||
515 | int pathlen; | ||
516 | |||
517 | cwd = getcwd(NULL, 0); | ||
518 | memset(dirname, 0, sizeof dirname); | ||
519 | |||
520 | snprintf(dirname, sizeof dirname, "%s/", | ||
521 | cwd[1] ? cwd : ""); | ||
522 | |||
523 | pathlen = strlen(dirname); | ||
524 | rc = kbd_input(dirname + pathlen, (sizeof dirname)-pathlen); | ||
525 | if(rc < 0) | ||
526 | return false; | ||
527 | |||
528 | rc = mkdir(dirname, 0); | ||
529 | if(rc < 0) { | ||
530 | splash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED)); | ||
531 | } else { | ||
532 | onplay_result = ONPLAY_RELOAD_DIR; | ||
533 | } | ||
534 | |||
535 | return true; | ||
536 | } | ||
537 | |||
510 | int onplay(char* file, int attr) | 538 | int onplay(char* file, int attr) |
511 | { | 539 | { |
512 | struct menu_items menu[5]; /* increase this if you add entries! */ | 540 | struct menu_items menu[5]; /* increase this if you add entries! */ |
@@ -514,36 +542,43 @@ int onplay(char* file, int attr) | |||
514 | 542 | ||
515 | onplay_result = ONPLAY_OK; | 543 | onplay_result = ONPLAY_OK; |
516 | 544 | ||
517 | selected_file = file; | 545 | if(file) |
518 | selected_file_attr = attr; | ||
519 | |||
520 | if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || | ||
521 | (attr & ATTR_DIRECTORY) || | ||
522 | ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) | ||
523 | { | 546 | { |
524 | menu[i].desc = str(LANG_PLAYINDICES_PLAYLIST); | 547 | selected_file = file; |
525 | menu[i].function = playlist_options; | 548 | selected_file_attr = attr; |
549 | |||
550 | if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || | ||
551 | (attr & ATTR_DIRECTORY) || | ||
552 | ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) | ||
553 | { | ||
554 | menu[i].desc = str(LANG_PLAYINDICES_PLAYLIST); | ||
555 | menu[i].function = playlist_options; | ||
556 | i++; | ||
557 | } | ||
558 | |||
559 | menu[i].desc = str(LANG_RENAME); | ||
560 | menu[i].function = rename_file; | ||
526 | i++; | 561 | i++; |
562 | |||
563 | if (!(attr & ATTR_DIRECTORY)) | ||
564 | { | ||
565 | menu[i].desc = str(LANG_DELETE); | ||
566 | menu[i].function = delete_file; | ||
567 | i++; | ||
568 | } | ||
569 | |||
570 | if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | ||
571 | { | ||
572 | menu[i].desc = str(LANG_VBRFIX); | ||
573 | menu[i].function = vbr_fix; | ||
574 | i++; | ||
575 | } | ||
527 | } | 576 | } |
528 | 577 | ||
529 | menu[i].desc = str(LANG_RENAME); | 578 | menu[i].desc = str(LANG_CREATE_DIR); |
530 | menu[i].function = rename_file; | 579 | menu[i].function = create_dir; |
531 | i++; | 580 | i++; |
532 | 581 | ||
533 | if (!(attr & ATTR_DIRECTORY)) | ||
534 | { | ||
535 | menu[i].desc = str(LANG_DELETE); | ||
536 | menu[i].function = delete_file; | ||
537 | i++; | ||
538 | } | ||
539 | |||
540 | if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | ||
541 | { | ||
542 | menu[i].desc = str(LANG_VBRFIX); | ||
543 | menu[i].function = vbr_fix; | ||
544 | i++; | ||
545 | } | ||
546 | |||
547 | /* DIY menu handling, since we want to exit after selection */ | 582 | /* DIY menu handling, since we want to exit after selection */ |
548 | m = menu_init( menu, i ); | 583 | m = menu_init( menu, i ); |
549 | result = menu_show(m); | 584 | result = menu_show(m); |
diff --git a/apps/tree.c b/apps/tree.c index aedeeb1dfd..88fb2f3ab0 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -773,16 +773,18 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen, | |||
773 | int onplay_result; | 773 | int onplay_result; |
774 | 774 | ||
775 | if(!numentries) | 775 | if(!numentries) |
776 | break; | 776 | onplay_result = onplay(NULL, 0); |
777 | else { | ||
778 | if (currdir[1]) | ||
779 | snprintf(buf, sizeof buf, "%s/%s", | ||
780 | currdir, dircache[dircursor+dirstart].name); | ||
781 | else | ||
782 | snprintf(buf, sizeof buf, "/%s", | ||
783 | dircache[dircursor+dirstart].name); | ||
784 | onplay_result = onplay(buf, | ||
785 | dircache[dircursor+dirstart].attr); | ||
786 | } | ||
777 | 787 | ||
778 | if (currdir[1]) | ||
779 | snprintf(buf, sizeof buf, "%s/%s", | ||
780 | currdir, dircache[dircursor+dirstart].name); | ||
781 | else | ||
782 | snprintf(buf, sizeof buf, "/%s", | ||
783 | dircache[dircursor+dirstart].name); | ||
784 | onplay_result = onplay(buf, | ||
785 | dircache[dircursor+dirstart].attr); | ||
786 | switch (onplay_result) | 788 | switch (onplay_result) |
787 | { | 789 | { |
788 | case ONPLAY_OK: | 790 | case ONPLAY_OK: |
@@ -1502,30 +1504,6 @@ bool create_playlist(void) | |||
1502 | return true; | 1504 | return true; |
1503 | } | 1505 | } |
1504 | 1506 | ||
1505 | bool create_dir(void) | ||
1506 | { | ||
1507 | char dirname[MAX_PATH]; | ||
1508 | int rc; | ||
1509 | int pathlen; | ||
1510 | |||
1511 | memset(dirname, 0, sizeof dirname); | ||
1512 | |||
1513 | snprintf(dirname, sizeof dirname, "%s/", | ||
1514 | currdir[1] ? currdir : ""); | ||
1515 | |||
1516 | pathlen = strlen(dirname); | ||
1517 | rc = kbd_input(dirname + pathlen, (sizeof dirname)-pathlen); | ||
1518 | if(rc < 0) | ||
1519 | return false; | ||
1520 | |||
1521 | rc = mkdir(dirname, 0); | ||
1522 | if(rc < 0) { | ||
1523 | splash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED)); | ||
1524 | } | ||
1525 | |||
1526 | return true; | ||
1527 | } | ||
1528 | |||
1529 | bool rockbox_browse(char *root, int dirfilter) | 1507 | bool rockbox_browse(char *root, int dirfilter) |
1530 | { | 1508 | { |
1531 | bool rc; | 1509 | bool rc; |
diff --git a/apps/tree.h b/apps/tree.h index 45297361f5..c7b678eb82 100644 --- a/apps/tree.h +++ b/apps/tree.h | |||
@@ -47,7 +47,6 @@ void browse_root(void); | |||
47 | void set_current_file(char *path); | 47 | void set_current_file(char *path); |
48 | bool rockbox_browse(char *root, int dirfilter); | 48 | bool rockbox_browse(char *root, int dirfilter); |
49 | bool create_playlist(void); | 49 | bool create_playlist(void); |
50 | bool create_dir(void); | ||
51 | void resume_directory(char *dir); | 50 | void resume_directory(char *dir); |
52 | char *getcwd(char *buf, int size); | 51 | char *getcwd(char *buf, int size); |
53 | void reload_directory(void); | 52 | void reload_directory(void); |