Add AAC audio type
[Rockbox.git] / apps / playlist_menu.c
blobc6ccd5a45a587322a773aabba0c81634e1fa2d78
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Björn Stenberg
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include <string.h>
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 #include "playlist_viewer.h"
29 #include "talk.h"
30 #include "lang.h"
32 /* FIXME: there is a very similar function in onplay.c */
33 static bool save_playlist(void)
35 char filename[MAX_PATH+1];
37 strncpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(filename));
39 if (!kbd_input(filename, sizeof(filename)))
41 playlist_save(NULL, filename);
43 /* reload in case playlist was saved to cwd */
44 reload_directory();
47 return false;
50 static bool recurse_directory(void)
52 static const struct opt_items names[] = {
53 { STR(LANG_OFF) },
54 { STR(LANG_ON) },
55 { STR(LANG_RESUME_SETTING_ASK)},
58 return set_option( str(LANG_RECURSE_DIRECTORY),
59 &global_settings.recursive_dir_insert, INT, names, 3,
60 NULL );
63 bool playlist_menu(void)
65 int m;
66 bool result;
68 static const struct menu_item items[] = {
69 { ID2P(LANG_CREATE_PLAYLIST), create_playlist },
70 { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
71 { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
72 { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
75 m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
76 NULL, NULL, NULL );
77 result = menu_run(m);
78 menu_exit(m);
79 return result;