Moved LCD_WIDHT/HEIGHT from lcd driver to config file.
[kugel-rb.git] / apps / playlist_menu.c
blob3497b1d54d15b762c94f1bd4d54e8264c79162cd
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 #define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
34 static bool save_playlist(void)
36 char filename[MAX_PATH+1];
38 strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename));
40 if (!kbd_input(filename, sizeof(filename)))
42 playlist_save(NULL, filename);
44 /* reload in case playlist was saved to cwd */
45 reload_directory();
48 return false;
51 static bool recurse_directory(void)
53 static const struct opt_items names[] = {
54 { STR(LANG_OFF) },
55 { STR(LANG_ON) },
56 { STR(LANG_RESUME_SETTING_ASK)},
59 return set_option( str(LANG_RECURSE_DIRECTORY),
60 &global_settings.recursive_dir_insert, INT, names, 3,
61 NULL );
64 bool playlist_menu(void)
66 int m;
67 bool result;
69 static const struct menu_item items[] = {
70 { ID2P(LANG_CREATE_PLAYLIST), create_playlist },
71 { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
72 { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
73 { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
76 m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
77 NULL, NULL, NULL );
78 result = menu_run(m);
79 menu_exit(m);
80 return result;