[banshee] BpmEntry: Fix play button in track editor (bgo#655234)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] BpmEntry: Fix play button in track editor (bgo#655234)
- Date: Thu, 18 Aug 2011 23:06:11 +0000 (UTC)
commit 379937b07a8fef3366a89b0a421d575d7923e03a
Author: William Witt <william witt-family net>
Date: Sun Jul 31 14:53:01 2011 -0500
BpmEntry: Fix play button in track editor (bgo#655234)
Add PlayerEngine.Play() command to the play button's callback so that it
really plays.
When the button is clicked again, the track will pause, but only if it
was started from this button.
Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>
src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs | 21 +++++++++++++++++--
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs b/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
index 9156078..00d6805 100644
--- a/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
+++ b/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
@@ -182,9 +182,24 @@ namespace Banshee.Bpm
private void OnPlayClicked (object o, EventArgs args)
{
if (track != null) {
- ServiceManager.PlayerEngine.Open (track);
- Gtk.ActionGroup actions = ServiceManager.Get<InterfaceActionService> ().PlaybackActions;
- (actions["StopWhenFinishedAction"] as Gtk.ToggleAction).Active = true;
+ // Pause playback only if the selected track is playing.
+ if (ServiceManager.PlayerEngine.CurrentTrack == track
+ && ServiceManager.PlayerEngine.CurrentState == PlayerState.Playing) {
+ ServiceManager.PlayerEngine.Pause ();
+ Image play = new Image ();
+ play.IconName = "media-playback-start";
+ play.IconSize = (int)IconSize.Menu;
+ ((Button)o).Image = play;
+ } else {
+ ServiceManager.PlayerEngine.Open (track);
+ Gtk.ActionGroup actions = ServiceManager.Get<InterfaceActionService> ().PlaybackActions;
+ (actions["StopWhenFinishedAction"] as Gtk.ToggleAction).Active = true;
+ ServiceManager.PlayerEngine.Play ();
+ Image stop = new Image ();
+ stop.IconName = "media-playback-stop";
+ stop.IconSize = (int)IconSize.Menu;
+ ((Button)o).Image = stop;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]