forked from len0rd/rockbox
Moved Create Directory to the ON+Play menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4360 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5c8e82e097
commit
642cce2e33
4 changed files with 71 additions and 62 deletions
|
|
@ -304,7 +304,7 @@ bool main_menu(void)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
/* main menu */
|
/* main menu */
|
||||||
struct menu_items items[9];
|
struct menu_items items[8];
|
||||||
|
|
||||||
items[i].desc = str(LANG_BOOKMARK_MENU);
|
items[i].desc = str(LANG_BOOKMARK_MENU);
|
||||||
items[i++].function = bookmark_menu;
|
items[i++].function = bookmark_menu;
|
||||||
|
|
@ -336,9 +336,6 @@ bool main_menu(void)
|
||||||
items[i].desc = str(LANG_INFO);
|
items[i].desc = str(LANG_INFO);
|
||||||
items[i++].function = info_menu;
|
items[i++].function = info_menu;
|
||||||
|
|
||||||
items[i].desc = str(LANG_CREATE_DIR);
|
|
||||||
items[i++].function = create_dir;
|
|
||||||
|
|
||||||
m=menu_init( items, i );
|
m=menu_init( items, i );
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
status_set_param(true);
|
status_set_param(true);
|
||||||
|
|
|
||||||
|
|
@ -507,6 +507,34 @@ static bool vbr_fix(void)
|
||||||
return false;
|
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)
|
int onplay(char* file, int attr)
|
||||||
{
|
{
|
||||||
struct menu_items menu[5]; /* increase this if you add entries! */
|
struct menu_items menu[5]; /* increase this if you add entries! */
|
||||||
|
|
@ -514,6 +542,8 @@ int onplay(char* file, int attr)
|
||||||
|
|
||||||
onplay_result = ONPLAY_OK;
|
onplay_result = ONPLAY_OK;
|
||||||
|
|
||||||
|
if(file)
|
||||||
|
{
|
||||||
selected_file = file;
|
selected_file = file;
|
||||||
selected_file_attr = attr;
|
selected_file_attr = attr;
|
||||||
|
|
||||||
|
|
@ -543,6 +573,11 @@ int onplay(char* file, int attr)
|
||||||
menu[i].function = vbr_fix;
|
menu[i].function = vbr_fix;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menu[i].desc = str(LANG_CREATE_DIR);
|
||||||
|
menu[i].function = create_dir;
|
||||||
|
i++;
|
||||||
|
|
||||||
/* DIY menu handling, since we want to exit after selection */
|
/* DIY menu handling, since we want to exit after selection */
|
||||||
m = menu_init( menu, i );
|
m = menu_init( menu, i );
|
||||||
|
|
|
||||||
30
apps/tree.c
30
apps/tree.c
|
|
@ -773,8 +773,8 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
|
||||||
int onplay_result;
|
int onplay_result;
|
||||||
|
|
||||||
if(!numentries)
|
if(!numentries)
|
||||||
break;
|
onplay_result = onplay(NULL, 0);
|
||||||
|
else {
|
||||||
if (currdir[1])
|
if (currdir[1])
|
||||||
snprintf(buf, sizeof buf, "%s/%s",
|
snprintf(buf, sizeof buf, "%s/%s",
|
||||||
currdir, dircache[dircursor+dirstart].name);
|
currdir, dircache[dircursor+dirstart].name);
|
||||||
|
|
@ -783,6 +783,8 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
|
||||||
dircache[dircursor+dirstart].name);
|
dircache[dircursor+dirstart].name);
|
||||||
onplay_result = onplay(buf,
|
onplay_result = onplay(buf,
|
||||||
dircache[dircursor+dirstart].attr);
|
dircache[dircursor+dirstart].attr);
|
||||||
|
}
|
||||||
|
|
||||||
switch (onplay_result)
|
switch (onplay_result)
|
||||||
{
|
{
|
||||||
case ONPLAY_OK:
|
case ONPLAY_OK:
|
||||||
|
|
@ -1502,30 +1504,6 @@ bool create_playlist(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool create_dir(void)
|
|
||||||
{
|
|
||||||
char dirname[MAX_PATH];
|
|
||||||
int rc;
|
|
||||||
int pathlen;
|
|
||||||
|
|
||||||
memset(dirname, 0, sizeof dirname);
|
|
||||||
|
|
||||||
snprintf(dirname, sizeof dirname, "%s/",
|
|
||||||
currdir[1] ? currdir : "");
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rockbox_browse(char *root, int dirfilter)
|
bool rockbox_browse(char *root, int dirfilter)
|
||||||
{
|
{
|
||||||
bool rc;
|
bool rc;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ void browse_root(void);
|
||||||
void set_current_file(char *path);
|
void set_current_file(char *path);
|
||||||
bool rockbox_browse(char *root, int dirfilter);
|
bool rockbox_browse(char *root, int dirfilter);
|
||||||
bool create_playlist(void);
|
bool create_playlist(void);
|
||||||
bool create_dir(void);
|
|
||||||
void resume_directory(char *dir);
|
void resume_directory(char *dir);
|
||||||
char *getcwd(char *buf, int size);
|
char *getcwd(char *buf, int size);
|
||||||
void reload_directory(void);
|
void reload_directory(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue