diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-10-21 13:47:43 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-10-21 13:47:43 +0000 |
commit | 0465101f92e45c06009a4d94079cea2218734785 (patch) | |
tree | a76c9920bb7d4ed3135cf072a9d0dd097dfea9fd /apps | |
parent | c1051549b93d1905602ba25409cbd8f4a607c3b5 (diff) | |
download | rockbox-0465101f92e45c06009a4d94079cea2218734785.tar.gz rockbox-0465101f92e45c06009a4d94079cea2218734785.zip |
allow simplelists to set the timeout and the start selection.
set a slightly saner default timeout
talk the selected item when the list is first displayed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15247 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 1 | ||||
-rw-r--r-- | apps/gui/list.c | 10 | ||||
-rw-r--r-- | apps/gui/list.h | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 81f1c58d55..5bb8a8b1fc 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1880,6 +1880,7 @@ static bool dbg_tagcache_info(void) | |||
1880 | simplelist_info_init(&info, "Database Info", 8, NULL); | 1880 | simplelist_info_init(&info, "Database Info", 8, NULL); |
1881 | info.action_callback = database_callback; | 1881 | info.action_callback = database_callback; |
1882 | info.hide_selection = true; | 1882 | info.hide_selection = true; |
1883 | info.timeout = TIMEOUT_NOBLOCK; | ||
1883 | tagcache_screensync_enable(true); | 1884 | tagcache_screensync_enable(true); |
1884 | return simplelist_show_list(&info); | 1885 | return simplelist_show_list(&info); |
1885 | } | 1886 | } |
diff --git a/apps/gui/list.c b/apps/gui/list.c index 5c16c00aeb..2450720a13 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -1179,13 +1179,17 @@ bool simplelist_show_list(struct simplelist_info *info) | |||
1179 | gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size); | 1179 | gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size); |
1180 | else | 1180 | else |
1181 | gui_synclist_set_nb_items(&lists, info->count*info->selection_size); | 1181 | gui_synclist_set_nb_items(&lists, info->count*info->selection_size); |
1182 | 1182 | ||
1183 | gui_synclist_select_item(&lists, info->start_selection); | ||
1184 | |||
1185 | if (info->get_talk) | ||
1186 | info->get_talk(gui_synclist_get_sel_pos(&lists), info->callback_data); | ||
1183 | gui_synclist_draw(&lists); | 1187 | gui_synclist_draw(&lists); |
1184 | 1188 | ||
1185 | while(1) | 1189 | while(1) |
1186 | { | 1190 | { |
1187 | gui_syncstatusbar_draw(&statusbars, true); | 1191 | gui_syncstatusbar_draw(&statusbars, true); |
1188 | action = get_action(CONTEXT_STD, HZ/100); | 1192 | action = get_action(CONTEXT_STD, info->timeout); |
1189 | if (gui_synclist_do_button(&lists, &action, LIST_WRAP_UNLESS_HELD)) | 1193 | if (gui_synclist_do_button(&lists, &action, LIST_WRAP_UNLESS_HELD)) |
1190 | continue; | 1194 | continue; |
1191 | if (info->action_callback) | 1195 | if (info->action_callback) |
@@ -1218,6 +1222,8 @@ void simplelist_info_init(struct simplelist_info *info, char* title, | |||
1218 | info->selection_size = 1; | 1222 | info->selection_size = 1; |
1219 | info->hide_selection = false; | 1223 | info->hide_selection = false; |
1220 | info->scroll_all = false; | 1224 | info->scroll_all = false; |
1225 | info->timeout = HZ/10; | ||
1226 | info->start_selection = 0; | ||
1221 | info->action_callback = NULL; | 1227 | info->action_callback = NULL; |
1222 | info->get_icon = NULL; | 1228 | info->get_icon = NULL; |
1223 | info->get_name = NULL; | 1229 | info->get_name = NULL; |
diff --git a/apps/gui/list.h b/apps/gui/list.h index e6a80f4714..742e30dbaa 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -267,6 +267,8 @@ struct simplelist_info { | |||
267 | char selection_size; /* list selection size, usually 1 */ | 267 | char selection_size; /* list selection size, usually 1 */ |
268 | bool hide_selection; | 268 | bool hide_selection; |
269 | bool scroll_all; | 269 | bool scroll_all; |
270 | int timeout; | ||
271 | int start_selection; /* the item to select when the list is first displayed */ | ||
270 | int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */ | 272 | int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */ |
271 | /* action_callback notes: | 273 | /* action_callback notes: |
272 | action == the action pressed by the user | 274 | action == the action pressed by the user |
@@ -303,6 +305,8 @@ void simplelist_addline(int line_number, const char *fmt, ...); | |||
303 | info.get_icon = NULL; | 305 | info.get_icon = NULL; |
304 | info.get_name = NULL; | 306 | info.get_name = NULL; |
305 | info.get_voice = NULL; | 307 | info.get_voice = NULL; |
308 | info.timeout = HZ/10; | ||
309 | info.start_selection = 0; | ||
306 | */ | 310 | */ |
307 | void simplelist_info_init(struct simplelist_info *info, char* title, | 311 | void simplelist_info_init(struct simplelist_info *info, char* title, |
308 | int count, void* data); | 312 | int count, void* data); |