1
0
Fork 0
forked from len0rd/rockbox

Patch #1260463 - Warn on erasing modified dynamic playlist by Craig (ctb311276)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8589 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Hardeep Sidhu 2006-02-05 19:35:03 +00:00
parent d350e80b40
commit 941de8586c
5 changed files with 48 additions and 0 deletions

View file

@ -40,6 +40,7 @@
#include "sprintf.h"
#include "dircache.h"
#include "splash.h"
#include "yesno.h"
#ifndef SIMULATOR
static int boot_size = 0;
@ -346,6 +347,18 @@ int ft_enter(struct tree_context* c)
if (bookmark_autoload(buf))
break;
/* about to create a new current playlist...
allow user to cancel the operation */
if (global_settings.warnon_erase_dynplaylist &&
playlist_modified(NULL))
{
char *lines[]={str(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)};
struct text_message message={lines, 1};
if(gui_syncyesno_run(&message, NULL, NULL) != YESNO_YES)
break;
}
if (playlist_create(c->currdir, file->name) != -1)
{
if (global_settings.playlist_shuffle)
@ -360,6 +373,18 @@ int ft_enter(struct tree_context* c)
if (bookmark_autoload(c->currdir))
break;
/* about to create a new current playlist...
allow user to cancel the operation */
if (global_settings.warnon_erase_dynplaylist &&
playlist_modified(NULL))
{
char *lines[]={str(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)};
struct text_message message={lines, 1};
if(gui_syncyesno_run(&message, NULL, NULL) != YESNO_YES)
break;
}
if (playlist_create(c->currdir, NULL) != -1)
{
start_index = ft_build_playlist(c, c->selected_item);

View file

@ -3599,3 +3599,14 @@ eng: "Backdrop failed"
voice: "Backdrop failed"
new:
id: LANG_WARN_ERASEDYNPLAYLIST_MENU
desc: in playlist options menu, option to warn when erasing dynamic playlist
eng: "Warn When Erasing Dynamic Playlist"
voice ""
new:
id: LANG_WARN_ERASEDYNPLAYLIST_PROMPT
desc: prompt shown when about to erase a modified dynamic playlist
eng: "Erase dynamic playlist?"
voice ""
new:

View file

@ -60,6 +60,12 @@ static bool recurse_directory(void)
NULL );
}
static bool warnon_option(void)
{
return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU),
&global_settings.warnon_erase_dynplaylist);
}
bool playlist_menu(void)
{
int m;
@ -70,6 +76,7 @@ bool playlist_menu(void)
{ ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
{ ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
{ ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
{ ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU), warnon_option},
};
m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL,

View file

@ -508,6 +508,9 @@ static const struct bit_entry hd_bits[] =
#endif
#endif /* HAVE_LCD_BITMAP */
{1, S_O(warnon_erase_dynplaylist), false,
"warn when erasing dynamic playlist", off_on },
/* If values are just added to the end, no need to bump the version. */
/* new stuff to be added at the end */

View file

@ -411,6 +411,8 @@ struct user_settings
#ifdef HAVE_LCD_COLOR
unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */
#endif
bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */
};
enum optiontype { INT, BOOL };