aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/playlist.c4
-rw-r--r--src/playlist.h7
-rw-r--r--src/playlist_control.c40
4 files changed, 13 insertions, 39 deletions
diff --git a/NEWS b/NEWS
index 6e771f935..17e10f0f4 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.16 (20??/??/??)
- removed the deprecated "volume" command
- added the "findadd" command
- range support for "delete"
+ - "previous" really plays the previous song
* input:
- lastfm: use metadata
* tags:
diff --git a/src/playlist.c b/src/playlist.c
index 162103c2e..62a723d34 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -62,16 +62,12 @@ playlist_init(struct playlist *playlist)
playlist->queued = -1;
playlist->current = -1;
-
- playlist->prev_elapsed = g_timer_new();
}
void
playlist_finish(struct playlist *playlist)
{
queue_finish(&playlist->queue);
-
- g_timer_destroy(playlist->prev_elapsed);
}
/**
diff --git a/src/playlist.h b/src/playlist.h
index 311163e8b..f8f5bd942 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -81,13 +81,6 @@ struct playlist {
* This variable is only valid if #playing is true.
*/
int queued;
-
- /**
- * This timer tracks the time elapsed since the last "prev"
- * command. If that is less than one second ago, "prev" jumps
- * to the previous song instead of rewinding the current song.
- */
- GTimer *prev_elapsed;
};
/** the global playlist object */
diff --git a/src/playlist_control.c b/src/playlist_control.c
index cfbcd19f1..16f4d5738 100644
--- a/src/playlist_control.c
+++ b/src/playlist_control.c
@@ -30,14 +30,6 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "playlist"
-enum {
- /**
- * When the "prev" command is received, rewind the current
- * track if this number of seconds has already elapsed.
- */
- PLAYLIST_PREV_UNLESS_ELAPSED = 10,
-};
-
void playlist_stop(struct playlist *playlist)
{
if (!playlist->playing)
@@ -191,29 +183,21 @@ void playlist_previous(struct playlist *playlist)
if (!playlist->playing)
return;
- if (g_timer_elapsed(playlist->prev_elapsed, NULL) >= 1.0 &&
- getPlayerElapsedTime() > PLAYLIST_PREV_UNLESS_ELAPSED) {
- /* re-start playing the current song (just like the
- "prev" button on CD players) */
+ assert(queue_length(&playlist->queue) > 0);
- playlist_play_order(playlist, playlist->current);
+ if (playlist->current > 0) {
+ /* play the preceding song */
+ playlist_play_order(playlist,
+ playlist->current - 1);
+ } else if (playlist->queue.repeat) {
+ /* play the last song in "repeat" mode */
+ playlist_play_order(playlist,
+ queue_length(&playlist->queue) - 1);
} else {
- if (playlist->current > 0) {
- /* play the preceding song */
- playlist_play_order(playlist,
- playlist->current - 1);
- } else if (playlist->queue.repeat) {
- /* play the last song in "repeat" mode */
- playlist_play_order(playlist,
- queue_length(&playlist->queue) - 1);
- } else {
- /* re-start playing the current song if it's
- the first one */
- playlist_play_order(playlist, playlist->current);
- }
+ /* re-start playing the current song if it's
+ the first one */
+ playlist_play_order(playlist, playlist->current);
}
-
- g_timer_start(playlist->prev_elapsed);
}
enum playlist_result