From 0465101f92e45c06009a4d94079cea2218734785 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 21 Oct 2007 13:47:43 +0000 Subject: 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 --- apps/debug_menu.c | 1 + apps/gui/list.c | 10 ++++++++-- apps/gui/list.h | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'apps') 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) simplelist_info_init(&info, "Database Info", 8, NULL); info.action_callback = database_callback; info.hide_selection = true; + info.timeout = TIMEOUT_NOBLOCK; tagcache_screensync_enable(true); return simplelist_show_list(&info); } 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) gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size); else gui_synclist_set_nb_items(&lists, info->count*info->selection_size); - + + gui_synclist_select_item(&lists, info->start_selection); + + if (info->get_talk) + info->get_talk(gui_synclist_get_sel_pos(&lists), info->callback_data); gui_synclist_draw(&lists); while(1) { gui_syncstatusbar_draw(&statusbars, true); - action = get_action(CONTEXT_STD, HZ/100); + action = get_action(CONTEXT_STD, info->timeout); if (gui_synclist_do_button(&lists, &action, LIST_WRAP_UNLESS_HELD)) continue; if (info->action_callback) @@ -1218,6 +1222,8 @@ void simplelist_info_init(struct simplelist_info *info, char* title, info->selection_size = 1; info->hide_selection = false; info->scroll_all = false; + info->timeout = HZ/10; + info->start_selection = 0; info->action_callback = NULL; info->get_icon = NULL; 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 { char selection_size; /* list selection size, usually 1 */ bool hide_selection; bool scroll_all; + int timeout; + int start_selection; /* the item to select when the list is first displayed */ int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */ /* action_callback notes: action == the action pressed by the user @@ -303,6 +305,8 @@ void simplelist_addline(int line_number, const char *fmt, ...); info.get_icon = NULL; info.get_name = NULL; info.get_voice = NULL; + info.timeout = HZ/10; + info.start_selection = 0; */ void simplelist_info_init(struct simplelist_info *info, char* title, int count, void* data); -- cgit v1.2.3