summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-04-05 22:36:42 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-04-05 22:36:42 +0000
commita69c495e5dd91b7404f92f4f44e773ef8cd59683 (patch)
treecdf7df205e42493172eff94fcecc0b2786d10e31
parent51deb1d158cc6f136f7839b3a0657fc1b58162fc (diff)
downloadrockbox-a69c495e5dd91b7404f92f4f44e773ef8cd59683.tar.gz
rockbox-a69c495e5dd91b7404f92f4f44e773ef8cd59683.zip
Patches from bug #5001 by Rani Hod, should make settings more resiliant to having 'off-step' values in a general way, but specifically fixes that bug report, and also round the current sleep timer value up when entering settings for sleep timer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9527 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/option_select.c16
-rw-r--r--apps/settings_menu.c2
-rw-r--r--docs/CREDITS2
3 files changed, 11 insertions, 9 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index d482bd24ae..045f5570c4 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -78,13 +78,15 @@ void option_select_prev(struct option_select * opt)
78{ 78{
79 if(opt->option - opt->step < opt->min_value) 79 if(opt->option - opt->step < opt->min_value)
80 { 80 {
81 if(!opt->limit_loop) 81 /* the dissimilarity to option_select_next() arises from the
82 { 82 * sleep timer problem (bug #5000 and #5001):
83 if(opt->option==opt->min_value) 83 * there we have min=0, step = 5 but the value itself might
84 opt->option=opt->max_value-1; 84 * not be a multiple of 5 -- as time elapsed;
85 else 85 * We need to be able to set timer to 0 (= Off) nevertheless. */
86 opt->option=opt->min_value; 86 if(opt->option!=opt->min_value)
87 } 87 opt->option=opt->min_value;
88 else if(!opt->limit_loop)
89 opt->option=opt->max_value-1;
88 } 90 }
89 else 91 else
90 opt->option-=opt->step; 92 opt->option-=opt->step;
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 987994a41b..04f8c0c9af 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -827,7 +827,7 @@ static void sleep_timer_set(int minutes)
827 827
828static bool sleep_timer(void) 828static bool sleep_timer(void)
829{ 829{
830 int minutes = get_sleep_timer() / 60; 830 int minutes = (get_sleep_timer() + 59) / 60; /* round up */
831 831
832 return set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes, 832 return set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes,
833 &sleep_timer_set, 5, 0, 300, sleep_timer_formatter); 833 &sleep_timer_set, 5, 0, 300, sleep_timer_formatter);
diff --git a/docs/CREDITS b/docs/CREDITS
index cb9c4e0901..3f66170da8 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -193,4 +193,4 @@ Mark Bright
193Dominik Riebeling 193Dominik Riebeling
194Alexander Bondar 194Alexander Bondar
195Peter Cawley 195Peter Cawley
196 196Rani Hod