[banshee/1.5.1-fixes: 51/56] Restart songs using multimedia keys (bgo#607067)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/1.5.1-fixes: 51/56] Restart songs using multimedia keys (bgo#607067)
- Date: Mon, 22 Mar 2010 18:08:21 +0000 (UTC)
commit ae0499b04ee48adc292eff2369a3c8266eb1945b
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Feb 25 12:06:19 2010 -0800
Restart songs using multimedia keys (bgo#607067)
When pressing the "Previous" button in the UI we restart the playing song
if its position is more than 4 seconds. Use the same logic when "Previous"
button is pressed on the multimedia keyboard.
Conflicts:
src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
.../PlaybackControllerService.cs | 16 +++++++++++++++-
.../Banshee.Gui/PlaybackActions.cs | 7 +------
.../MultimediaKeysService.cs | 2 +-
3 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs b/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
index c7c5959..1015706 100644
--- a/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
+++ b/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
@@ -252,7 +252,21 @@ namespace Banshee.PlaybackController
OnTransition ();
}
-
+
+ public void RestartOrPrevious ()
+ {
+ const int delay = 4000; // ms
+ if (player_engine.Position < delay) {
+ Previous ();
+ } else {
+ var track = player_engine.CurrentTrack;
+ if (track != null) {
+ player_engine.Close ();
+ player_engine.OpenPlay (track);
+ }
+ }
+ }
+
bool IBasicPlaybackController.First ()
{
if (Source.Count > 0) {
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
index ae35070..c88d599 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
@@ -215,12 +215,7 @@ namespace Banshee.Gui
private void OnPreviousAction (object o, EventArgs args)
{
- const int delay = 4000; // ms
- if (ServiceManager.PlayerEngine.Position < delay) {
- ServiceManager.PlaybackController.Previous ();
- } else {
- OnRestartSongAction (o, args);
- }
+ ServiceManager.PlaybackController.RestartOrPrevious ();
}
private void OnSeekToAction (object o, EventArgs args)
diff --git a/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs b/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs
index 739a5ef..128f975 100644
--- a/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs
+++ b/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs
@@ -148,7 +148,7 @@ namespace Banshee.MultimediaKeys
ServiceManager.PlaybackController.Next ();
break;
case "Previous":
- ServiceManager.PlaybackController.Previous ();
+ ServiceManager.PlaybackController.RestartOrPrevious ();
break;
case "Stop":
ServiceManager.PlayerEngine.Close ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]