FS#6948 - Fix the broken 'follow playlist' feature
[Rockbox.git] / apps / main_menu.c
blob9d702cbb4a64fcb60bd7417415b7cf4657b46367
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 ****************************************************************************/
19 #include <timefuncs.h>
20 #include "config.h"
21 #include "menu.h"
22 #include "tree.h"
23 #include "lcd.h"
24 #include "font.h"
25 #include "action.h"
26 #include "kernel.h"
27 #include "main_menu.h"
28 #include "debug_menu.h"
29 #include "sprintf.h"
30 #include <string.h>
31 #include "settings.h"
32 #include "settings_menu.h"
33 #include "power.h"
34 #include "powermgmt.h"
35 #include "sound_menu.h"
36 #include "status.h"
37 #include "fat.h"
38 #include "bookmark.h"
39 #include "buffer.h"
40 #include "screens.h"
41 #include "playlist_menu.h"
42 #include "talk.h"
43 #if CONFIG_TUNER
44 #include "radio.h"
45 #endif
46 #include "misc.h"
47 #include "lang.h"
48 #include "logfdisp.h"
49 #include "plugin.h"
50 #include "filetypes.h"
51 #include "splash.h"
53 #ifdef HAVE_RECORDING
54 #include "recording.h"
55 #endif
57 #ifdef HAVE_RECORDING
59 static bool rec_menu_recording_screen(void)
61 return recording_screen(false);
64 static bool recording_settings(void)
66 bool ret;
67 #ifdef HAVE_FMRADIO_IN
68 int rec_source = global_settings.rec_source;
69 #endif
71 ret = recording_menu(false);
73 #ifdef HAVE_FMRADIO_IN
74 if (rec_source != global_settings.rec_source)
76 if (rec_source == AUDIO_SRC_FMRADIO)
77 radio_stop();
78 /* If AUDIO_SRC_FMRADIO was selected from something else,
79 the recording screen will start the radio */
81 #endif
83 return ret;
86 bool rec_menu(void)
88 int m;
89 bool result;
91 /* recording menu */
92 static const struct menu_item items[] = {
93 { ID2P(LANG_RECORDING_MENU), rec_menu_recording_screen },
94 { ID2P(LANG_RECORDING_SETTINGS), recording_settings},
97 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
98 NULL, NULL, NULL);
99 result = menu_run(m);
100 menu_exit(m);
102 return result;
104 #endif
107 #if 0
108 #ifdef HAVE_LCD_CHARCELLS
109 static bool do_shutdown(void)
111 sys_poweroff();
112 return false;
114 #endif
115 bool main_menu(void)
117 int m;
118 bool result;
119 int i = 0;
120 static bool inside_menu = false;
123 /* main menu */
124 struct menu_item items[11];
126 if(inside_menu) return false;
127 inside_menu = true;
129 items[i].desc = ID2P(LANG_SOUND_SETTINGS);
130 items[i++].function = sound_menu;
132 items[i].desc = ID2P(LANG_GENERAL_SETTINGS);
133 items[i++].function = settings_menu;
135 items[i].desc = ID2P(LANG_MANAGE_MENU);
136 items[i++].function = manage_settings_menu;
138 items[i].desc = ID2P(LANG_CUSTOM_THEME);
139 items[i++].function = custom_theme_browse;
141 #if CONFIG_TUNER
142 if(radio_hardware_present()) {
143 items[i].desc = ID2P(LANG_FM_RADIO);
144 items[i++].function = radio_screen;
146 #endif
148 #ifdef HAVE_RECORDING
149 items[i].desc = ID2P(LANG_RECORDING);
150 items[i++].function = rec_menu;
151 #endif
153 items[i].desc = ID2P(LANG_PLAYLIST_MENU);
154 items[i++].function = playlist_menu;
156 items[i].desc = ID2P(LANG_PLUGINS);
157 items[i++].function = plugin_browse;
159 items[i].desc = ID2P(LANG_INFO);
160 items[i++].function = info_menu;
162 #ifdef HAVE_LCD_CHARCELLS
163 items[i].desc = ID2P(LANG_SHUTDOWN);
164 items[i++].function = do_shutdown;
165 #endif
167 m=menu_init( items, i, NULL, NULL, NULL, NULL );
168 #ifdef HAVE_LCD_CHARCELLS
169 status_set_param(true);
170 #endif
171 result = menu_run(m);
172 #ifdef HAVE_LCD_CHARCELLS
173 status_set_param(false);
174 #endif
175 menu_exit(m);
177 inside_menu = false;
179 return result;
181 #endif
182 /* -----------------------------------------------------------------
183 * vim: et sw=4 ts=8 sts=4 tw=78