diff options
Diffstat (limited to 'apps/menus/settings_menu.c')
-rw-r--r-- | apps/menus/settings_menu.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 508f7214a1..818271b623 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -38,6 +38,12 @@ | |||
38 | #ifdef HAVE_ALARM_MOD | 38 | #ifdef HAVE_ALARM_MOD |
39 | #include "alarm_menu.h" | 39 | #include "alarm_menu.h" |
40 | #endif | 40 | #endif |
41 | #ifdef CONFIG_RTC | ||
42 | #include "rtc.h" | ||
43 | #endif | ||
44 | |||
45 | /* callback to display rtc menus dynamically */ | ||
46 | int rtc_detect_callback(int action,const struct menu_item_ex *this_item); | ||
41 | 47 | ||
42 | /***********************************/ | 48 | /***********************************/ |
43 | /* TAGCACHE MENU */ | 49 | /* TAGCACHE MENU */ |
@@ -206,7 +212,7 @@ static int timedate_set(void) | |||
206 | 212 | ||
207 | MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, NOICON); | 213 | MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, NOICON); |
208 | MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL); | 214 | MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL); |
209 | MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, NOICON, &time_set, &timeformat); | 215 | MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), rtc_detect_callback, NOICON, &time_set, &timeformat); |
210 | #endif | 216 | #endif |
211 | 217 | ||
212 | /* System menu */ | 218 | /* System menu */ |
@@ -246,7 +252,7 @@ MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer, | |||
246 | setting to the user */ | 252 | setting to the user */ |
247 | #ifdef HAVE_ALARM_MOD | 253 | #ifdef HAVE_ALARM_MOD |
248 | MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU), | 254 | MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU), |
249 | (menu_function)alarm_screen, NULL, NOICON); | 255 | (menu_function)alarm_screen, rtc_detect_callback, NOICON); |
250 | #endif | 256 | #endif |
251 | 257 | ||
252 | /* Limits menu */ | 258 | /* Limits menu */ |
@@ -383,3 +389,23 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0, | |||
383 | &bookmark_settings_menu, &browse_langs, &voice_settings_menu ); | 389 | &bookmark_settings_menu, &browse_langs, &voice_settings_menu ); |
384 | /* SETTINGS MENU */ | 390 | /* SETTINGS MENU */ |
385 | /***********************************/ | 391 | /***********************************/ |
392 | |||
393 | /* callback to display rtc menus dynamically */ | ||
394 | int rtc_detect_callback(int action,const struct menu_item_ex *this_item) | ||
395 | { | ||
396 | if (action != ACTION_REQUEST_MENUITEM) | ||
397 | return action; | ||
398 | |||
399 | #if defined(CONFIG_RTC) && CONFIG_RTC == RTC_DS1339_DS3231 | ||
400 | if ((this_item == &time_menu) || | ||
401 | (this_item == &alarm_screen_call)) | ||
402 | { | ||
403 | if (!rtc_detected) | ||
404 | return ACTION_EXIT_MENUITEM; | ||
405 | } | ||
406 | #else | ||
407 | (void)this_item; | ||
408 | #endif | ||
409 | |||
410 | return action; | ||
411 | } | ||