[gnome-music] Store first/last song
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Store first/last song
- Date: Wed, 24 Apr 2013 14:10:26 +0000 (UTC)
commit 8791f1a1e0aa5ece79f57c84d5d5ec95568e7db0
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Wed Apr 24 11:15:47 2013 +0200
Store first/last song
Click Next several times on last song, play Prev - playback is not stuck
src/player.js | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/player.js b/src/player.js
index 2afb3c3..67862db 100644
--- a/src/player.js
+++ b/src/player.js
@@ -175,9 +175,15 @@ const Player = new Lang.Class({
},
playNext: function () {
+ if (this.currentTrack)
+ this.prevTrack = this.currentTrack.copy()
if (!this.playlist || !this.currentTrack || !this.playlist.iter_next(this.currentTrack)){
this.stop();
- this.currentTrack=null;
+ if (this.prevTrack) {
+ this.currentTrack = this.prevTrack.copy();
+ } else {
+ this.currentTrack = null;
+ }
return;
}
this.stop();
@@ -187,7 +193,11 @@ const Player = new Lang.Class({
playPrevious: function () {
if (!this.playlist || !this.currentTrack || !this.playlist.iter_previous(this.currentTrack)){
this.stop();
- this.currentTrack=null;
+ if (!this.playlist) {
+ this.currentTrack = null;
+ } else {
+ this.currentTrack = this.playlist.get_iter_first()[1];
+ }
return;}
this.stop();
this.play();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]