summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2013-03-27 22:43:40 +1100
committerJonathan Gordon <rockbox@jdgordon.info>2013-03-29 13:41:48 +1100
commit087ff2e59057cbc378ec3c2be3a9af12c7407514 (patch)
tree11312a67e3456d5768cc97ced96d33265d1baadc
parentbe394af7d4ff6e41b8978c973bb4baf89e7dec9d (diff)
downloadrockbox-087ff2e59057cbc378ec3c2be3a9af12c7407514.tar.gz
rockbox-087ff2e59057cbc378ec3c2be3a9af12c7407514.zip
simplelist: Fix simplelist_set_line_count() so it actually sets the count
(hopefully) Fixes FS#12838 Change-Id: I932184afaf7b65121a0c459cd03c8482e3bad22b
-rw-r--r--apps/debug_menu.c26
-rw-r--r--apps/gui/list.c8
2 files changed, 32 insertions, 2 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index c4291879c3..3fe28fb1c9 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1838,6 +1838,31 @@ static bool dbg_save_roms(void)
1838} 1838}
1839#endif /* CPU */ 1839#endif /* CPU */
1840 1840
1841static int radio_callback(int btn, struct gui_synclist *lists)
1842{
1843 (void)lists;
1844 if (btn == ACTION_STD_CANCEL)
1845 return btn;
1846 simplelist_set_line_count(1);
1847 simplelist_addline("test one");
1848 simplelist_addline("test two");
1849 simplelist_addline("test dsaf");
1850 simplelist_addline("test asdfsad");
1851 simplelist_addline("-------------");
1852 return ACTION_REDRAW;
1853}
1854static bool dbg_fm_radio(void)
1855{
1856 struct simplelist_info info;
1857 info.scroll_all = true;
1858 simplelist_info_init(&info, "FM Radio", 1, NULL);
1859 simplelist_set_line_count(0);
1860 simplelist_addline("HW detected: %s", "no");
1861
1862 info.action_callback = radio_callback;
1863 info.hide_selection = true;
1864 return simplelist_show_list(&info);
1865}
1841#ifndef SIMULATOR 1866#ifndef SIMULATOR
1842#if CONFIG_TUNER 1867#if CONFIG_TUNER
1843 1868
@@ -2324,6 +2349,7 @@ static const struct {
2324 { "FM Radio", dbg_fm_radio }, 2349 { "FM Radio", dbg_fm_radio },
2325#endif 2350#endif
2326#endif 2351#endif
2352 { "TEST HERE", dbg_fm_radio},
2327#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) 2353#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2328 { "Write back EEPROM", dbg_write_eeprom }, 2354 { "Write back EEPROM", dbg_write_eeprom },
2329#endif 2355#endif
diff --git a/apps/gui/list.c b/apps/gui/list.c
index cc43843e46..27032378c3 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -843,8 +843,12 @@ void simplelist_set_line_count(int lines)
843 simplelist_line_remaining = sizeof(simplelist_buffer); 843 simplelist_line_remaining = sizeof(simplelist_buffer);
844 simplelist_line_count = 0; 844 simplelist_line_count = 0;
845 } 845 }
846 else if (lines >= SIMPLELIST_MAX_LINES) 846 else if (lines < simplelist_line_count) {
847 simplelist_line_count = SIMPLELIST_MAX_LINES; 847 char *end = simplelist_text[lines];
848 simplelist_line_pos = end - simplelist_buffer;
849 simplelist_line_remaining = sizeof(simplelist_buffer) - simplelist_line_pos;
850 simplelist_line_count = lines;
851 }
848} 852}
849/* get the current amount of lines shown */ 853/* get the current amount of lines shown */
850int simplelist_get_line_count(void) 854int simplelist_get_line_count(void)