summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2006-02-05 19:35:03 +0000
committerHardeep Sidhu <dyp@pobox.com>2006-02-05 19:35:03 +0000
commit941de8586c1d64742b5947cb4a49092478755eb5 (patch)
treee296a145fbd5561575d599a6a02bcf34ecbc6460
parentd350e80b40a655e79a4f073fe35d126fc91e960c (diff)
downloadrockbox-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
-rw-r--r--apps/filetree.c25
-rw-r--r--apps/lang/english.lang11
-rw-r--r--apps/playlist_menu.c7
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings.h2
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
45static int boot_size = 0; 46static 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"
3599voice: "Backdrop failed" 3599voice: "Backdrop failed"
3600new: 3600new:
3601 3601
3602id: LANG_WARN_ERASEDYNPLAYLIST_MENU
3603desc: in playlist options menu, option to warn when erasing dynamic playlist
3604eng: "Warn When Erasing Dynamic Playlist"
3605voice ""
3606new:
3607
3608id: LANG_WARN_ERASEDYNPLAYLIST_PROMPT
3609desc: prompt shown when about to erase a modified dynamic playlist
3610eng: "Erase dynamic playlist?"
3611voice ""
3612new:
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
63static bool warnon_option(void)
64{
65 return set_bool(str(LANG_WARN_ERASEDYNPLAYLIST_MENU),
66 &global_settings.warnon_erase_dynplaylist);
67}
68
63bool playlist_menu(void) 69bool 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
416enum optiontype { INT, BOOL }; 418enum optiontype { INT, BOOL };