summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2006-04-20 07:30:28 +0000
committerHardeep Sidhu <dyp@pobox.com>2006-04-20 07:30:28 +0000
commitc7f304e1b9259a9f19f18daa71b6d199539b4a08 (patch)
treeb1ddd17802051fcb0923d3eaf0a8ceb26a5f9fd9
parent24f0a374c64d09de4e92e2b46e893671ab9deced (diff)
downloadrockbox-c7f304e1b9259a9f19f18daa71b6d199539b4a08.tar.gz
rockbox-c7f304e1b9259a9f19f18daa71b6d199539b4a08.tar.bz2
rockbox-c7f304e1b9259a9f19f18daa71b6d199539b4a08.zip
Stop playback and exit viewer if last track in current playlist is removed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9739 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playlist_viewer.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index ae27211ac2..2bbd2772f7 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -412,7 +412,7 @@ static bool update_playlist(bool force)
{
/* Reload tracks */
viewer.num_tracks = nb_tracks;
- if (viewer.num_tracks < 0)
+ if (viewer.num_tracks <= 0)
return false;
playlist_buffer_load_entries_screen(&viewer.buffer, FORWARD);
if (viewer.buffer.num_loaded <= 0)
@@ -457,16 +457,21 @@ static int onplay_menu(int index)
playlist_delete(viewer.playlist, current_track->index);
if (current)
{
- /* Start playing new track except if it's the last track
- in the playlist and repeat mode is disabled */
- current_track=
- playlist_buffer_get_track(&viewer.buffer, index);
- if (current_track->display_index != viewer.num_tracks ||
- global_settings.repeat_mode == REPEAT_ALL)
+ if (playlist_amount_ex(viewer.playlist) <= 0)
+ audio_stop();
+ else
{
- talk_buffer_steal(); /* will use the mp3 buffer */
- audio_play(0);
- viewer.current_playing_track = -1;
+ /* Start playing new track except if it's the lasttrack
+ track in the playlist and repeat mode is disabled */
+ current_track =
+ playlist_buffer_get_track(&viewer.buffer, index);
+ if (current_track->display_index!=viewer.num_tracks ||
+ global_settings.repeat_mode == REPEAT_ALL)
+ {
+ talk_buffer_steal(); /* will use the mp3 buffer */
+ audio_play(0);
+ viewer.current_playing_track = -1;
+ }
}
}
ret = 1;