summaryrefslogtreecommitdiffstats
path: root/apps/playlist_viewer.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-20 23:10:19 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-20 23:10:19 +0000
commitaa01ee314e5505d1c640951db57505626defba1b (patch)
treebcfd04a9f34264dcfb18db1cccd0321f2a638433 /apps/playlist_viewer.c
parent1c80a1f2f0e746c380fde60297127ea2ad4fab79 (diff)
downloadrockbox-aa01ee314e5505d1c640951db57505626defba1b.tar.gz
rockbox-aa01ee314e5505d1c640951db57505626defba1b.tar.bz2
rockbox-aa01ee314e5505d1c640951db57505626defba1b.zip
Fix a bug in playlist viewer's list handling, causing superfluous redraws and
potentially leading to the wrong track being selected. The playlist viewer should perform a bit better now. I always felt it was slower than the otehr lists. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28131 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist_viewer.c')
-rw-r--r--apps/playlist_viewer.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index e0ab3bb9bd..59b05a231e 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -653,18 +653,21 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename)
/* Timeout so we can determine if play status has changed */
button = get_action(CONTEXT_TREE,HZ/2);
- if( (gui_synclist_do_button(&playlist_lists, &button,LIST_WRAP_UNLESS_HELD)) )
+ bool res = gui_synclist_do_button(&playlist_lists,
+ &button,
+ LIST_WRAP_UNLESS_HELD);
+ viewer.selected_track=gui_synclist_get_sel_pos(&playlist_lists);
+
+ if (res)
{
- viewer.selected_track=gui_synclist_get_sel_pos(&playlist_lists);
- if(playlist_buffer_needs_reload(&viewer.buffer,
- viewer.selected_track))
+ bool reload = playlist_buffer_needs_reload(&viewer.buffer,
+ viewer.selected_track);
+ if(reload)
+ {
playlist_buffer_load_entries_screen(&viewer.buffer,
- button==ACTION_STD_NEXT?
- FORWARD
- :
- BACKWARD
- );
- gui_synclist_draw(&playlist_lists);
+ button == ACTION_STD_NEXT ? FORWARD : BACKWARD);
+ gui_synclist_draw(&playlist_lists);
+ }
}
switch (button)
{
@@ -686,8 +689,9 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename)
case ACTION_STD_OK:
{
struct playlist_entry * current_track =
- playlist_buffer_get_track(&viewer.buffer,
- viewer.selected_track);
+ playlist_buffer_get_track(&viewer.buffer,
+ viewer.selected_track);
+
if (viewer.moving_track >= 0)
{
/* Move track */
@@ -847,10 +851,11 @@ bool search_playlist(void)
break;
case ACTION_STD_OK:
- playlist_start(
- found_indicies[gui_synclist_get_sel_pos(&playlist_lists)]
- ,0);
+ {
+ int sel = gui_synclist_get_sel_pos(&playlist_lists);
+ playlist_start(found_indicies[sel] ,0);
exit = 1;
+ }
break;
default: