summaryrefslogtreecommitdiff
path: root/apps/playlist_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist_menu.c')
-rw-r--r--apps/playlist_menu.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c
new file mode 100644
index 0000000000..3508240efe
--- /dev/null
+++ b/apps/playlist_menu.c
@@ -0,0 +1,71 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <string.h>
21
22#include "menu.h"
23#include "file.h"
24#include "keyboard.h"
25#include "playlist.h"
26#include "tree.h"
27#include "settings.h"
28
29#include "lang.h"
30
31#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
32
33static bool save_playlist(void)
34{
35 char filename[MAX_PATH+1];
36
37 strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename));
38
39 if (!kbd_input(filename, sizeof(filename)))
40 {
41 playlist_save(filename);
42
43 /* reload in case playlist was saved to cwd */
44 reload_directory();
45 }
46
47 return false;
48}
49
50static bool recurse_directory(void)
51{
52 return (set_bool( str(LANG_RECURSE_DIRECTORY),
53 &global_settings.recursive_dir_insert));
54}
55
56bool playlist_menu(void)
57{
58 int m;
59 bool result;
60
61 struct menu_items items[] = {
62 { str(LANG_CREATE_PLAYLIST), create_playlist },
63 { str(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
64 { str(LANG_RECURSE_DIRECTORY), recurse_directory },
65 };
66
67 m = menu_init( items, sizeof items / sizeof(struct menu_items) );
68 result = menu_run(m);
69 menu_exit(m);
70 return result;
71}