[banshee] [PlayQueue] Correct track reordering (bgo#613333)
- From: Alexander Kojevnikov <alexk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [PlayQueue] Correct track reordering (bgo#613333)
- Date: Sun, 6 Jun 2010 09:16:00 +0000 (UTC)
commit be197cad1e9611dd82af5acea1b1f74f6f62d2eb
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date: Sun Jun 6 19:10:48 2010 +1000
[PlayQueue] Correct track reordering (bgo#613333)
.../Banshee.PlayQueue/PlayQueueSource.cs | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
index de9c88f..bb7a9c3 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
@@ -469,18 +469,23 @@ namespace Banshee.PlayQueue
public override void ReorderSelectedTracks (int drop_row)
{
- // If the current_track is not playing, make the first pending unselected track the current one.
+ // If the current_track is not playing, dropping tracks may change it.
+ // If the selection is dropped above the current_track, the first pending
+ // of the dropped tracks (if any) will become the new current_track.
+ // If the tracks are dropped below the curren_track,
+ // the first pending track not in the selection will become current.
if (current_track != null && !ServiceManager.PlayerEngine.IsPlaying (current_track)) {
int current_index = TrackModel.IndexOf (current_track);
+ bool above = drop_row <= current_index;
int new_index = -1;
for (int index = current_index; index < TrackModel.Count; index++) {
- if (!TrackModel.Selection.Contains (index)) {
+ if (above == TrackModel.Selection.Contains (index)) {
new_index = index;
break;
}
}
- if (new_index != current_index) {
- SetCurrentTrack (new_index == -1 ? null : TrackModel[new_index] as DatabaseTrackInfo);
+ if (new_index != current_index && new_index >= 0) {
+ SetCurrentTrack (TrackModel[new_index] as DatabaseTrackInfo);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]