From 67df5f24341cb040139cf694886e6d06bdd96d70 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 25 Sep 2008 07:56:34 +0000 Subject: have the info lists set the selection before they are exited, this is sometimes needed by the caller git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18640 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/list.c | 5 +++-- apps/gui/list.h | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/gui/list.c b/apps/gui/list.c index 77ec090b04..6f0b4ed19c 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -876,7 +876,7 @@ bool simplelist_show_list(struct simplelist_info *info) else gui_synclist_set_nb_items(&lists, info->count*info->selection_size); - gui_synclist_select_item(&lists, info->start_selection); + gui_synclist_select_item(&lists, info->selection); gui_synclist_draw(&lists); gui_synclist_speak_item(&lists); @@ -910,6 +910,7 @@ bool simplelist_show_list(struct simplelist_info *info) else if(default_event_handler(action) == SYS_USB_CONNECTED) return true; } + info->selection = gui_synclist_get_sel_pos(&lists); talk_shutup(); return false; } @@ -923,7 +924,7 @@ void simplelist_info_init(struct simplelist_info *info, char* title, info->hide_selection = false; info->scroll_all = false; info->timeout = HZ/10; - info->start_selection = 0; + info->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 8db9c24d48..efbb56ea5f 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h @@ -206,7 +206,9 @@ struct simplelist_info { bool hide_selection; bool scroll_all; int timeout; - int start_selection; /* the item to select when the list is first displayed */ + int selection; /* the item to select when the list is first displayed */ + /* when the list is exited, this will be set to the + index of the last item selected */ int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */ /* action_callback notes: action == the action pressed by the user @@ -244,7 +246,7 @@ void simplelist_addline(int line_number, const char *fmt, ...); info.get_name = NULL; info.get_voice = NULL; info.timeout = HZ/10; - info.start_selection = 0; + info.selection = 0; */ void simplelist_info_init(struct simplelist_info *info, char* title, int count, void* data); -- cgit v1.2.3