From dabcb81e1380aeab8e50a64efcc1dc4a59145094 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Thu, 1 May 2008 10:13:12 +0000 Subject: Introduce a small helper function that asks the user if the dynamic playlist should be erased to increase code re-use git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17295 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index c97b9cf0f3..23341a82e8 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -50,6 +50,8 @@ #include "tagcache.h" #include "scrobbler.h" #include "sound.h" +#include "playlist.h" +#include "yesno.h" #ifdef HAVE_MMC #include "ata_mmc.h" @@ -244,6 +246,24 @@ char *create_datetime_filename(char *buffer, const char *path, } #endif /* CONFIG_RTC */ +/* Ask the user if they really want to erase the current dynamic playlist + * returns true if the playlist should be replaced */ +bool warn_on_pl_erase(void) +{ + if (global_settings.warnon_erase_dynplaylist && + !global_settings.party_mode && + playlist_modified(NULL)) + { + static const char *lines[] = + {ID2P(LANG_WARN_ERASEDYNPLAYLIST_PROMPT)}; + static const struct text_message message={lines, 1}; + + return (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES); + } + else + return true; +} + /* Read (up to) a line of text from fd into buffer and return number of bytes * read (which may be larger than the number of bytes stored in buffer). If * an error occurs, -1 is returned (and buffer contains whatever could be -- cgit v1.2.3