summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-03-02 13:58:56 +0000
committerDave Chapman <dave@dchapman.com>2007-03-02 13:58:56 +0000
commitfdaacd5ec6433d1cde41a4d541771933dbacf906 (patch)
tree8af59713095517129e84692fb02a69859af7ec14
parent485561594459d9645cd1a733d7b5eb15e1c19d05 (diff)
downloadrockbox-fdaacd5ec6433d1cde41a4d541771933dbacf906.zip
rockbox-fdaacd5ec6433d1cde41a4d541771933dbacf906.tar.gz
rockbox-fdaacd5ec6433d1cde41a4d541771933dbacf906.tar.bz2
rockbox-fdaacd5ec6433d1cde41a4d541771933dbacf906.tar.xz
Move Sleep Timer function from the settings into the System menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12549 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/menus/main_menu.c37
-rw-r--r--apps/menus/settings_menu.c33
2 files changed, 36 insertions, 34 deletions
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index d986436..d8b4718 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -341,6 +341,40 @@ static bool show_info(void)
}
MENUITEM_FUNCTION(show_info_item, ID2P(LANG_INFO_MENU),
(menu_function)show_info, NULL, NOICON);
+
+
+/* sleep Menu */
+static void sleep_timer_formatter(char* buffer, int buffer_size, int value,
+ const char* unit)
+{
+ int minutes, hours;
+
+ (void) unit;
+
+ if (value) {
+ hours = value / 60;
+ minutes = value - (hours * 60);
+ snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
+ } else {
+ snprintf(buffer, buffer_size, "%s", str(LANG_OFF));
+ }
+}
+
+static void sleep_timer_set(int minutes)
+{
+ set_sleep_timer(minutes * 60);
+}
+
+static int sleep_timer(void)
+{
+ int minutes = (get_sleep_timer() + 59) / 60; /* round up */
+ return (int)set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes,
+ &sleep_timer_set, -5, 300, 0, sleep_timer_formatter);
+}
+
+MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer,
+ NULL, bitmap_icons_6x8[Icon_Menu_setting]); /* make it look like a
+ setting to the user */
MENUITEM_FUNCTION(show_credits_item, ID2P(LANG_VERSION),
(menu_function)show_credits, NULL, NOICON);
MENUITEM_FUNCTION(show_runtime_item, ID2P(LANG_RUNNING_TIME),
@@ -359,7 +393,8 @@ MENUITEM_FUNCTION(logfdump_item, "logfdump",(int (*)(void)) logfdump, NULL, NOIC
#endif
MAKE_MENU(info_menu, ID2P(LANG_INFO), 0, bitmap_icons_6x8[Icon_Questionmark],
- &show_info_item, &show_credits_item, &show_runtime_item,
+ &show_info_item, &show_credits_item, &show_runtime_item,
+ &sleep_timer_call,
#ifndef SIMULATOR
&debug_menu_item
#else
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index ec7ccd8..050bf88 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -214,38 +214,6 @@ MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), rtc_detect_callback, NOICON, &time_se
/* System menu */
MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
-/* sleep Menu */
-static void sleep_timer_formatter(char* buffer, int buffer_size, int value,
- const char* unit)
-{
- int minutes, hours;
-
- (void) unit;
-
- if (value) {
- hours = value / 60;
- minutes = value - (hours * 60);
- snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
- } else {
- snprintf(buffer, buffer_size, "%s", str(LANG_OFF));
- }
-}
-
-static void sleep_timer_set(int minutes)
-{
- set_sleep_timer(minutes * 60);
-}
-
-static int sleep_timer(void)
-{
- int minutes = (get_sleep_timer() + 59) / 60; /* round up */
- return (int)set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes,
- &sleep_timer_set, -5, 300, 0, sleep_timer_formatter);
-}
-
-MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer,
- NULL, bitmap_icons_6x8[Icon_Menu_setting]); /* make it look like a
- setting to the user */
#ifdef HAVE_RTC_ALARM
MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
(menu_function)alarm_screen, rtc_detect_callback, NOICON);
@@ -292,7 +260,6 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
&time_menu,
#endif
&poweroff,
- &sleep_timer_call,
#ifdef HAVE_RTC_ALARM
&alarm_screen_call,
#endif