diff options
author | Hardeep Sidhu <dyp@pobox.com> | 2006-02-05 19:35:03 +0000 |
---|---|---|
committer | Hardeep Sidhu <dyp@pobox.com> | 2006-02-05 19:35:03 +0000 |
commit | 941de8586c1d64742b5947cb4a49092478755eb5 (patch) | |
tree | e296a145fbd5561575d599a6a02bcf34ecbc6460 /apps | |
parent | d350e80b40a655e79a4f073fe35d126fc91e960c (diff) | |
download | rockbox-941de8586c1d64742b5947cb4a49092478755eb5.tar.gz rockbox-941de8586c1d64742b5947cb4a49092478755eb5.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetree.c | 25 | ||||
-rw-r--r-- | apps/lang/english.lang | 11 | ||||
-rw-r--r-- | apps/playlist_menu.c | 7 | ||||
-rw-r--r-- | apps/settings.c | 3 | ||||
-rw-r--r-- | apps/settings.h | 2 |
5 files changed, 48 insertions, 0 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index cb21b71eec..b8f066745f 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "sprintf.h" | 40 | #include "sprintf.h" |
41 | #include "dircache.h" | 41 | #include "dircache.h" |
42 | #include "splash.h" | 42 | #include "splash.h" |
43 | #include "yesno.h" | ||
43 | 44 | ||
44 | #ifndef SIMULATOR | 45 | #ifndef SIMULATOR |
45 | static int boot_size = 0; | 46 | static int boot_size = 0; |
@@ -346,6 +347,18 @@ int ft_enter(struct tree_context* c) | |||
346 | if (bookmark_autoload(buf)) | 347 | if (bookmark_autoload(buf)) |
347 | break; | 348 | break; |
348 | 349 | ||
350 | /* about to create a new current playlist... | ||
351 | allow user to cancel the operation */ | ||
352 | if (global_settings.warnon_erase_dynplaylist && | ||
353 | playlist_modified(NULL)) | ||
354 | { | ||
355 | char *lines[]={str(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)}; | ||
356 | struct text_message message={lines, 1}; | ||
357 | |||
358 | if(gui_syncyesno_run(&message, NULL, NULL) != YESNO_YES) | ||
359 | break; | ||
360 | } | ||
361 | |||
349 | if (playlist_create(c->currdir, file->name) != -1) | 362 | if (playlist_create(c->currdir, file->name) != -1) |
350 | { | 363 | { |
351 | if (global_settings.playlist_shuffle) | 364 | if (global_settings.playlist_shuffle) |
@@ -360,6 +373,18 @@ int ft_enter(struct tree_context* c) | |||
360 | if (bookmark_autoload(c->currdir)) | 373 | if (bookmark_autoload(c->currdir)) |
361 | break; | 374 | break; |
362 | 375 | ||
376 | /* about to create a new current playlist... | ||
377 | allow user to cancel the operation */ | ||
378 | if (global_settings.warnon_erase_dynplaylist && | ||
379 | playlist_modified(NULL)) | ||
380 | { | ||
381 | char *lines[]={str(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)}; | ||
382 | struct text_message message={lines, 1}; | ||
383 | |||
384 | if(gui_syncyesno_run(&message, NULL, NULL) != YESNO_YES) | ||
385 | break; | ||
386 | } | ||
387 | |||
363 | if (playlist_create(c->currdir, NULL) != -1) | 388 | if (playlist_create(c->currdir, NULL) != -1) |
364 | { | 389 | { |
365 | start_index = ft_build_playlist(c, c->selected_item); | 390 | start_index = ft_build_playlist(c, c->selected_item); |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index a2803ad432..c3d458e84c 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -3599,3 +3599,14 @@ eng: "Backdrop failed" | |||
3599 | voice: "Backdrop failed" | 3599 | voice: "Backdrop failed" |
3600 | new: | 3600 | new: |
3601 | 3601 | ||
3602 | id: LANG_WARN_ERASEDYNPLAYLIST_MENU | ||
3603 | desc: in playlist options menu, option to warn when erasing dynamic playlist | ||
3604 | eng: "Warn When Erasing Dynamic Playlist" | ||
3605 | voice "" | ||
3606 | new: | ||
3607 | |||
3608 | id: LANG_WARN_ERASEDYNPLAYLIST_PROMPT | ||
3609 | desc: prompt shown when about to erase a modified dynamic playlist | ||
3610 | eng: "Erase dynamic playlist?" | ||
3611 | voice "" | ||
3612 | new: | ||
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c index d59661a96c..c70a510a6e 100644 --- a/apps/playlist_menu.c +++ b/apps/playlist_menu.c | |||
@@ -60,6 +60,12 @@ static bool recurse_directory(void) | |||
60 | NULL ); | 60 | NULL ); |
61 | } | 61 | } |
62 | 62 | ||
63 | static bool warnon_option(void) | ||
64 | { | ||
65 | return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU), | ||
66 | &global_settings.warnon_erase_dynplaylist); | ||
67 | } | ||
68 | |||
63 | bool playlist_menu(void) | 69 | bool playlist_menu(void) |
64 | { | 70 | { |
65 | int m; | 71 | int m; |
@@ -70,6 +76,7 @@ bool playlist_menu(void) | |||
70 | { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, | 76 | { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, |
71 | { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, | 77 | { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, |
72 | { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory }, | 78 | { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory }, |
79 | { ID2P(LANG_WARN_ERASEDYNPLAYLIST_MENU), warnon_option}, | ||
73 | }; | 80 | }; |
74 | 81 | ||
75 | m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL, | 82 | m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL, |
diff --git a/apps/settings.c b/apps/settings.c index 07db21ef66..d13f56891e 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -508,6 +508,9 @@ static const struct bit_entry hd_bits[] = | |||
508 | #endif | 508 | #endif |
509 | #endif /* HAVE_LCD_BITMAP */ | 509 | #endif /* HAVE_LCD_BITMAP */ |
510 | 510 | ||
511 | {1, S_O(warnon_erase_dynplaylist), false, | ||
512 | "warn when erasing dynamic playlist", off_on }, | ||
513 | |||
511 | /* If values are just added to the end, no need to bump the version. */ | 514 | /* If values are just added to the end, no need to bump the version. */ |
512 | /* new stuff to be added at the end */ | 515 | /* new stuff to be added at the end */ |
513 | 516 | ||
diff --git a/apps/settings.h b/apps/settings.h index bb58336202..53dfde0c50 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -411,6 +411,8 @@ struct user_settings | |||
411 | #ifdef HAVE_LCD_COLOR | 411 | #ifdef HAVE_LCD_COLOR |
412 | unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */ | 412 | unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */ |
413 | #endif | 413 | #endif |
414 | |||
415 | bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */ | ||
414 | }; | 416 | }; |
415 | 417 | ||
416 | enum optiontype { INT, BOOL }; | 418 | enum optiontype { INT, BOOL }; |