banshee r3862 - in trunk/banshee: . libbanshee src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Clients/Nereid/Nereid src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.Services/Banshee.PlaybackController src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Extensions src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio src/Extensions/Banshee.MiniMode/Banshee.MiniMode src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3862 - in trunk/banshee: . libbanshee src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Clients/Nereid/Nereid src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.Services/Banshee.PlaybackController src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Extensions src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio src/Extensions/Banshee.MiniMode/Banshee.MiniMode src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue
- Date: Fri, 2 May 2008 18:47:13 +0100 (BST)
Author: abock
Date: Fri May 2 17:47:12 2008
New Revision: 3862
URL: http://svn.gnome.org/viewvc/banshee?rev=3862&view=rev
Log:
2008-05-02 Aaron Bockover <abock gnome org>
* src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs:
New event system for raising handlers based on a desired event mask;
handler masks can be modified, handlers can be removed, and handlers
can be prepended or appended to the event handler list
* src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEvent.cs: New
player event definitions and argument classes
* src/Core/Banshee.Services/Banshee.MediaEngine/IPlayerEngineService.cs:
* src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs:
* src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs:
* src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/GtkNotificationAreaBox.cs:
* src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs:
* src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/INotificationAreaBox.cs:
* src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs:
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs:
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs:
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs:
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs:
* src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs:
* src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs:
* src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
* src/Clients/Nereid/Nereid/PlayerInterface.cs:
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs:
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs:
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedVolumeButton.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs:
* src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs:
Updated to use the new player events API
Added:
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEvent.cs (contents, props changed)
- copied, changed from r3861, /trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineEvent.cs
Removed:
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineEvent.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineState.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/libbanshee/libbanshee.mdp
trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlayerEngineService.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedVolumeButton.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs
trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/GtkNotificationAreaBox.cs
trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/INotificationAreaBox.cs
trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs
trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
trunk/banshee/src/Extensions/Extensions.mds
Modified: trunk/banshee/libbanshee/libbanshee.mdp
==============================================================================
--- trunk/banshee/libbanshee/libbanshee.mdp (original)
+++ trunk/banshee/libbanshee/libbanshee.mdp Fri May 2 17:47:12 2008
@@ -1,5 +1,5 @@
<Project name="libbanshee" fileversion="2.0" language="C" ctype="CProject">
- <Configurations active="Debug">
+ <Configurations>
<Configuration name="Debug" ctype="CProjectConfiguration">
<Output directory="../bin" output="libbanshee" />
<Build debugmode="True" target="SharedLibrary" />
Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs (original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/PlayerEngine.cs Fri May 2 17:47:12 2008
@@ -110,7 +110,7 @@
bp_set_buffering_callback (handle, buffering_callback);
bp_set_tag_found_callback (handle, tag_found_callback);
- OnStateChanged (PlayerEngineState.Ready);
+ OnStateChanged (PlayerState.Ready);
if (pending_volume >= 0) {
Volume = (ushort)pending_volume;
@@ -148,13 +148,13 @@
public override void Play ()
{
bp_play (handle);
- OnStateChanged (PlayerEngineState.Playing);
+ OnStateChanged (PlayerState.Playing);
}
public override void Pause ()
{
bp_pause (handle);
- OnStateChanged (PlayerEngineState.Paused);
+ OnStateChanged (PlayerState.Paused);
}
public override void VideoExpose (IntPtr window, bool direct)
@@ -176,12 +176,12 @@
private void OnEos (IntPtr player)
{
Close (false);
- OnEventChanged (PlayerEngineEvent.EndOfStream);
+ OnEventChanged (PlayerEvent.EndOfStream);
}
private void OnIterate (IntPtr player)
{
- OnEventChanged (PlayerEngineEvent.Iterate);
+ OnEventChanged (PlayerEvent.Iterate);
}
private void OnError (IntPtr player, uint domain, int code, IntPtr error, IntPtr debug)
@@ -237,7 +237,7 @@
Log.Error (String.Format("GStreamer library error: {0}", (GstLibraryError) code), false);
}
- OnEventChanged (PlayerEngineEvent.Error, error_message);
+ OnEventChanged (new PlayerEventErrorArgs (error_message));
}
private void OnBuffering (IntPtr player, int progress)
@@ -247,7 +247,7 @@
}
buffering_finished = progress >= 100;
- OnEventChanged (PlayerEngineEvent.Buffering, Catalog.GetString ("Buffering"), (double) progress / 100.0);
+ OnEventChanged (new PlayerEventBufferingArgs ((double) progress / 100.0));
}
private void OnTagFound (IntPtr player, string tagName, ref GLib.Value value)
@@ -289,7 +289,7 @@
}
bp_set_volume (handle, (int)value);
- OnEventChanged (PlayerEngineEvent.Volume);
+ OnEventChanged (PlayerEvent.Volume);
}
}
@@ -297,7 +297,7 @@
get { return (uint)bp_get_position(handle); }
set {
bp_set_position(handle, (ulong)value);
- OnEventChanged (PlayerEngineEvent.Seek);
+ OnEventChanged (PlayerEvent.Seek);
}
}
Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs (original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs Fri May 2 17:47:12 2008
@@ -238,7 +238,10 @@
// Service events
ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
ServiceManager.SourceManager.SourceUpdated += OnSourceUpdated;
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.StartOfStream |
+ PlayerEvent.TrackInfoUpdated |
+ PlayerEvent.EndOfStream);
ActionService.TrackActions ["SearchForSameArtistAction"].Activated += OnProgrammaticSearch;
ActionService.TrackActions ["SearchForSameAlbumAction"].Activated += OnProgrammaticSearch;
@@ -364,15 +367,9 @@
}
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- switch (args.Event) {
- case PlayerEngineEvent.StartOfStream:
- case PlayerEngineEvent.TrackInfoUpdated:
- case PlayerEngineEvent.EndOfStream:
- UpdateTitle ();
- break;
- }
+ UpdateTitle ();
}
#endregion
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlayerEngineService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlayerEngineService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlayerEngineService.cs Fri May 2 17:47:12 2008
@@ -37,8 +37,8 @@
[Interface("org.bansheeproject.Banshee.PlayerEngine")]
public interface IPlayerEngineService : IDBusExportable
{
- event DBusPlayerEngineEventHandler EventChanged;
- event DBusPlayerEngineStateHandler StateChanged;
+ event DBusPlayerEventHandler EventChanged;
+ event DBusPlayerStateHandler StateChanged;
void Open (string uri);
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs Fri May 2 17:47:12 2008
@@ -29,6 +29,8 @@
using System;
using System.Collections;
+using Hyena;
+
using Banshee.Base;
using Banshee.Streaming;
using Banshee.Collection;
@@ -41,14 +43,13 @@
public const int VolumeDelta = 10;
public const int SkipDelta = 10;
- public event PlayerEngineStateHandler StateChanged;
- public event PlayerEngineEventHandler EventChanged;
+ public event PlayerEventHandler EventChanged;
private TrackInfo current_track;
private SafeUri current_uri;
- private PlayerEngineState current_state = PlayerEngineState.NotReady;
- private PlayerEngineState last_state = PlayerEngineState.NotReady;
- private PlayerEngineState idle_state = PlayerEngineState.NotReady;
+ private PlayerState current_state = PlayerState.NotReady;
+ private PlayerState last_state = PlayerState.NotReady;
+ private PlayerState idle_state = PlayerState.NotReady;
protected abstract void OpenUri (SafeUri uri);
@@ -87,28 +88,28 @@
private void HandleOpen (SafeUri uri)
{
- if (current_state != PlayerEngineState.Idle && current_state != PlayerEngineState.NotReady) {
+ if (current_state != PlayerState.Idle && current_state != PlayerState.NotReady) {
Close (false);
}
try {
OpenUri (uri);
- OnEventChanged (PlayerEngineEvent.StartOfStream);
- OnStateChanged (PlayerEngineState.Loaded);
+ OnEventChanged (PlayerEvent.StartOfStream);
+ OnStateChanged (PlayerState.Loaded);
} catch (Exception e) {
- Console.WriteLine (e);
- OnEventChanged (PlayerEngineEvent.Error, e.Message);
+ Log.Exception (e);
+ OnEventChanged (new PlayerEventErrorArgs (e.Message));
}
}
public virtual void Play ()
{
- OnStateChanged (PlayerEngineState.Playing);
+ OnStateChanged (PlayerState.Playing);
}
public virtual void Pause ()
{
- OnStateChanged (PlayerEngineState.Paused);
+ OnStateChanged (PlayerState.Paused);
}
public virtual void VideoExpose (IntPtr window, bool direct)
@@ -121,79 +122,54 @@
return null;
}
- protected virtual void OnStateChanged (PlayerEngineState state)
+ protected virtual void OnStateChanged (PlayerState state)
{
if (current_state == state) {
return;
}
- if (idle_state == PlayerEngineState.NotReady && state != PlayerEngineState.Ready) {
+ if (idle_state == PlayerState.NotReady && state != PlayerState.Ready) {
Hyena.Log.Warning ("Engine must transition to the ready state before other states can be entered", false);
return;
- } else if (idle_state == PlayerEngineState.NotReady && state == PlayerEngineState.Ready) {
- idle_state = PlayerEngineState.Idle;
- }
-
- if (ThreadAssist.InMainThread) {
- RaiseStateChanged (state);
- } else {
- ThreadAssist.ProxyToMain (delegate {
- RaiseStateChanged (state);
- });
+ } else if (idle_state == PlayerState.NotReady && state == PlayerState.Ready) {
+ idle_state = PlayerState.Idle;
}
+ last_state = current_state;
+ current_state = state;
+
+ OnEventChanged (new PlayerEventStateChangeArgs (last_state, current_state));
+
// Going to the Ready state automatically transitions to the Idle state
// The Ready state is advertised so one-time startup processes can easily
// happen outside of the engine itself
- if (state == PlayerEngineState.Ready) {
- OnStateChanged (PlayerEngineState.Idle);
+ if (state == PlayerState.Ready) {
+ OnStateChanged (PlayerState.Idle);
}
}
- private void RaiseStateChanged (PlayerEngineState state)
- {
- last_state = current_state;
- current_state = state;
-
- PlayerEngineStateHandler handler = StateChanged;
- if (handler != null) {
- PlayerEngineStateArgs args = new PlayerEngineStateArgs ();
- args.State = state;
- handler (this, args);
- }
- }
-
- protected void OnEventChanged (PlayerEngineEvent evnt)
- {
- OnEventChanged (evnt, null, 0.0);
- }
-
- protected void OnEventChanged (PlayerEngineEvent evnt, string message)
+ protected void OnEventChanged (PlayerEvent evnt)
{
- OnEventChanged (evnt, message, 0.0);
+ OnEventChanged (new PlayerEventArgs (evnt));
}
- protected virtual void OnEventChanged (PlayerEngineEvent evnt, string message, double bufferingPercent)
+ protected virtual void OnEventChanged (PlayerEventArgs args)
{
if (ThreadAssist.InMainThread) {
- RaiseEventChanged (evnt, message, bufferingPercent);
+ RaiseEventChanged (args);
} else {
ThreadAssist.ProxyToMain (delegate {
- RaiseEventChanged (evnt, message, bufferingPercent);
+ RaiseEventChanged (args);
});
}
}
- private void RaiseEventChanged (PlayerEngineEvent evnt, string message, double bufferingPercent)
+ private void RaiseEventChanged (PlayerEventArgs args)
{
- PlayerEngineEventHandler handler = EventChanged;
+ PlayerEventHandler handler = EventChanged;
if (handler != null) {
- PlayerEngineEventArgs args = new PlayerEngineEventArgs ();
- args.Event = evnt;
- args.Message = message;
- args.BufferingPercent = bufferingPercent;
- handler (this, args);
+ handler (args);
}
}
@@ -222,7 +198,7 @@
public void TrackInfoUpdated ()
{
- OnEventChanged (PlayerEngineEvent.TrackInfoUpdated);
+ OnEventChanged (PlayerEvent.TrackInfoUpdated);
}
public TrackInfo CurrentTrack {
@@ -233,11 +209,11 @@
get { return current_uri; }
}
- public PlayerEngineState CurrentState {
+ public PlayerState CurrentState {
get { return current_state; }
}
- public PlayerEngineState LastState {
+ public PlayerState LastState {
get { return last_state; }
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs Fri May 2 17:47:12 2008
@@ -56,19 +56,17 @@
private string preferred_engine_id = null;
- public event PlayerEngineEventHandler EventChanged;
- public event PlayerEngineStateHandler StateChanged;
public event EventHandler PlayWhenIdleRequest;
public event TrackInterceptHandler TrackIntercept;
- private event DBusPlayerEngineEventHandler dbus_event_changed;
- event DBusPlayerEngineEventHandler IPlayerEngineService.EventChanged {
+ private event DBusPlayerEventHandler dbus_event_changed;
+ event DBusPlayerEventHandler IPlayerEngineService.EventChanged {
add { dbus_event_changed += value; }
remove { dbus_event_changed -= value; }
}
- private event DBusPlayerEngineStateHandler dbus_state_changed;
- event DBusPlayerEngineStateHandler IPlayerEngineService.StateChanged {
+ private event DBusPlayerStateHandler dbus_state_changed;
+ event DBusPlayerStateHandler IPlayerEngineService.StateChanged {
add { dbus_state_changed += value; }
remove { dbus_state_changed -= value; }
}
@@ -116,10 +114,9 @@
private void LoadEngine (PlayerEngine engine)
{
- engine.StateChanged += OnEngineStateChanged;
engine.EventChanged += OnEngineEventChanged;
- if(engine.Id == preferred_engine_id) {
+ if (engine.Id == preferred_engine_id) {
DefaultEngine = engine;
} else {
if (active_engine == null) {
@@ -150,25 +147,19 @@
{
if (CurrentTrack != null && args.Track == CurrentTrack) {
foreach (StreamTag tag in args.ResultTags) {
- StreamTagger.TrackInfoMerge(CurrentTrack, tag);
+ StreamTagger.TrackInfoMerge (CurrentTrack, tag);
}
- PlayerEngineEventArgs eventargs = new PlayerEngineEventArgs ();
- eventargs.Event = PlayerEngineEvent.TrackInfoUpdated;
- OnEngineEventChanged (active_engine, eventargs);
+ OnEngineEventChanged (new PlayerEventArgs (PlayerEvent.TrackInfoUpdated));
}
}
- private void OnEngineStateChanged (object o, PlayerEngineStateArgs args)
+ private void HandleStateChange (PlayerEventStateChangeArgs args)
{
- if (o != active_engine) {
- return;
- }
-
- if (args.State == PlayerEngineState.Loaded && CurrentTrack != null) {
+ if (args.Current == PlayerState.Loaded && CurrentTrack != null) {
active_engine.Volume = (ushort) VolumeSchema.Get ();
MetadataService.Instance.Lookup (CurrentTrack);
- } else if (args.State == PlayerEngineState.Ready) {
+ } else if (args.Current == PlayerState.Ready) {
// Enable our preferred equalizer if it exists and was enabled last time.
if (SupportsEqualizer && EqualizerSetting.EnabledSchema.Get ()) {
string name = EqualizerSetting.PresetSchema.Get();
@@ -192,48 +183,39 @@
}
}
- PlayerEngineStateHandler handler = StateChanged;
- if (handler != null) {
- handler (o, args);
- }
-
- DBusPlayerEngineStateHandler dbus_handler = dbus_state_changed;
+ DBusPlayerStateHandler dbus_handler = dbus_state_changed;
if (dbus_handler != null) {
- dbus_handler (args.State.ToString ().ToLower ());
+ dbus_handler (args.Current.ToString ().ToLower ());
}
}
- private void OnEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnEngineEventChanged (PlayerEventArgs args)
{
- if (o != active_engine) {
- return;
- }
-
if (CurrentTrack != null) {
- if (args.Event == PlayerEngineEvent.Error
+ if (args.Event == PlayerEvent.Error
&& CurrentTrack.PlaybackError == StreamPlaybackError.None) {
CurrentTrack.PlaybackError = StreamPlaybackError.Unknown;
- } else if (args.Event == PlayerEngineEvent.Iterate
+ } else if (args.Event == PlayerEvent.Iterate
&& CurrentTrack.PlaybackError != StreamPlaybackError.None) {
CurrentTrack.PlaybackError = StreamPlaybackError.None;
}
}
- PlayerEngineEventHandler handler = EventChanged;
- if (handler != null) {
- handler(o, args);
- }
+ RaiseEvent (args);
// Do not raise iterate across DBus to avoid so many calls;
// DBus clients should do their own iterating and
// event/state checking locally
- if (args.Event == PlayerEngineEvent.Iterate) {
+ if (args.Event == PlayerEvent.Iterate) {
return;
}
- DBusPlayerEngineEventHandler dbus_handler = dbus_event_changed;
+ DBusPlayerEventHandler dbus_handler = dbus_event_changed;
if (dbus_handler != null) {
- dbus_handler (args.Event.ToString ().ToLower (), args.Message ?? String.Empty, args.BufferingPercent);
+ dbus_handler (args.Event.ToString ().ToLower (),
+ args is PlayerEventErrorArgs ? ((PlayerEventErrorArgs)args).Message : String.Empty,
+ args is PlayerEventBufferingArgs ? ((PlayerEventBufferingArgs)args).Progress : 0
+ );
}
}
@@ -298,7 +280,7 @@
private void OpenCheck (object o)
{
- if (CurrentState == PlayerEngineState.NotReady) {
+ if (CurrentState == PlayerState.NotReady) {
throw new InvalidOperationException (String.Format ("Player engine {0} is in the NotReady state",
active_engine.GetType ().FullName));
}
@@ -403,10 +385,10 @@
public void TogglePlaying ()
{
switch (CurrentState) {
- case PlayerEngineState.Idle:
+ case PlayerState.Idle:
OnPlayWhenIdleRequest ();
break;
- case PlayerEngineState.Playing:
+ case PlayerState.Playing:
Pause ();
break;
default:
@@ -436,13 +418,13 @@
public bool IsPlaying ()
{
- return CurrentState != PlayerEngineState.Idle && CurrentState != PlayerEngineState.NotReady;
+ return CurrentState != PlayerState.Idle && CurrentState != PlayerState.NotReady;
}
private void CheckPending ()
{
if(pending_engine != null && pending_engine != active_engine) {
- if(active_engine.CurrentState == PlayerEngineState.Idle) {
+ if(active_engine.CurrentState == PlayerState.Idle) {
Close ();
}
@@ -467,7 +449,7 @@
get { return CurrentSafeUri == null ? String.Empty : CurrentSafeUri.AbsoluteUri; }
}
- public PlayerEngineState CurrentState {
+ public PlayerState CurrentState {
get { return active_engine.CurrentState; }
}
@@ -475,7 +457,7 @@
get { return CurrentState.ToString ().ToLower (); }
}
- public PlayerEngineState LastState {
+ public PlayerState LastState {
get { return active_engine.LastState; }
}
@@ -549,6 +531,128 @@
get { return engines; }
}
+#region Player Event System
+
+ private LinkedList<PlayerEventHandlerSlot> event_handlers = new LinkedList<PlayerEventHandlerSlot> ();
+
+ private struct PlayerEventHandlerSlot
+ {
+ public PlayerEvent EventMask;
+ public PlayerEventHandler Handler;
+
+ public PlayerEventHandlerSlot (PlayerEvent mask, PlayerEventHandler handler)
+ {
+ EventMask = mask;
+ Handler = handler;
+ }
+ }
+
+ private const PlayerEvent event_all_mask = PlayerEvent.Iterate
+ | PlayerEvent.StateChange
+ | PlayerEvent.StartOfStream
+ | PlayerEvent.EndOfStream
+ | PlayerEvent.Buffering
+ | PlayerEvent.Seek
+ | PlayerEvent.Error
+ | PlayerEvent.Volume
+ | PlayerEvent.Metadata
+ | PlayerEvent.TrackInfoUpdated;
+
+ private const PlayerEvent event_default_mask = event_all_mask & ~PlayerEvent.Iterate;
+
+ private static void VerifyEventMask (PlayerEvent eventMask)
+ {
+ if (eventMask <= PlayerEvent.None || eventMask > event_all_mask) {
+ throw new ArgumentOutOfRangeException ("eventMask", "A valid event mask must be provided");
+ }
+ }
+
+ public void ConnectEvent (PlayerEventHandler handler)
+ {
+ ConnectEvent (handler, event_default_mask, false);
+ }
+
+ public void ConnectEvent (PlayerEventHandler handler, PlayerEvent eventMask)
+ {
+ ConnectEvent (handler, eventMask, false);
+ }
+
+ public void ConnectEvent (PlayerEventHandler handler, bool connectAfter)
+ {
+ ConnectEvent (handler, event_default_mask, connectAfter);
+ }
+
+ public void ConnectEvent (PlayerEventHandler handler, PlayerEvent eventMask, bool connectAfter)
+ {
+ lock (event_handlers) {
+ VerifyEventMask (eventMask);
+
+ PlayerEventHandlerSlot slot = new PlayerEventHandlerSlot (eventMask, handler);
+
+ if (connectAfter) {
+ event_handlers.AddLast (slot);
+ } else {
+ event_handlers.AddFirst (slot);
+ }
+ }
+ }
+
+ private LinkedListNode<PlayerEventHandlerSlot> FindEventNode (PlayerEventHandler handler)
+ {
+ LinkedListNode<PlayerEventHandlerSlot> node = event_handlers.First;
+ while (node != null) {
+ if (node.Value.Handler == handler) {
+ return node;
+ }
+ node = node.Next;
+ }
+
+ return null;
+ }
+
+ public void DisconnectEvent (PlayerEventHandler handler)
+ {
+ lock (event_handlers) {
+ LinkedListNode<PlayerEventHandlerSlot> node = FindEventNode (handler);
+ if (node != null) {
+ event_handlers.Remove (node);
+ }
+ }
+ }
+
+ public void ModifyEvent (PlayerEvent eventMask, PlayerEventHandler handler)
+ {
+ lock (event_handlers) {
+ VerifyEventMask (eventMask);
+
+ LinkedListNode<PlayerEventHandlerSlot> node = FindEventNode (handler);
+ if (node != null) {
+ PlayerEventHandlerSlot slot = node.Value;
+ slot.EventMask = eventMask;
+ node.Value = slot;
+ }
+ }
+ }
+
+ private void RaiseEvent (PlayerEventArgs args)
+ {
+ lock (event_handlers) {
+ if (args.Event == PlayerEvent.StateChange && args is PlayerEventStateChangeArgs) {
+ HandleStateChange ((PlayerEventStateChangeArgs)args);
+ }
+
+ LinkedListNode<PlayerEventHandlerSlot> node = event_handlers.First;
+ while (node != null) {
+ if ((node.Value.EventMask & args.Event) == args.Event) {
+ node.Value.Handler (args);
+ }
+ node = node.Next;
+ }
+ }
+ }
+
+#endregion
+
string IService.ServiceName {
get { return "PlayerEngine"; }
}
Copied: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEvent.cs (from r3861, /trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineEvent.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineEvent.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEvent.cs Fri May 2 17:47:12 2008
@@ -1,5 +1,5 @@
//
-// PlayerEngineEvent.cs
+// PlayerEvent.cs
//
// Author:
// Aaron Bockover <abockover novell com>
@@ -30,26 +30,95 @@
namespace Banshee.MediaEngine
{
- public delegate void DBusPlayerEngineEventHandler (string evnt, string message, double bufferingPercent);
- public delegate void PlayerEngineEventHandler (object o, PlayerEngineEventArgs args);
+ public delegate void DBusPlayerStateHandler (string state);
+ public delegate void DBusPlayerEventHandler (string evnt, string message, double bufferingPercent);
+ public delegate void PlayerEventHandler (PlayerEventArgs args);
- public sealed class PlayerEngineEventArgs : EventArgs
+ public class PlayerEventArgs : EventArgs
{
- public PlayerEngineEvent Event;
- public string Message;
- public double BufferingPercent;
- }
-
- public enum PlayerEngineEvent
- {
- Iterate,
- Seek,
- Error,
- Metadata,
- StartOfStream,
- EndOfStream,
- Volume,
- Buffering,
- TrackInfoUpdated
+ private PlayerEvent @event;
+ public PlayerEvent Event {
+ get { return @event; }
+ }
+
+ public PlayerEventArgs (PlayerEvent @event)
+ {
+ this event = @event;
+ }
+ }
+
+ public class PlayerEventStateChangeArgs : PlayerEventArgs
+ {
+ private PlayerState previous;
+ public PlayerState Previous {
+ get { return previous; }
+ }
+
+ private PlayerState current;
+ public PlayerState Current {
+ get { return current; }
+ }
+
+ public PlayerEventStateChangeArgs (PlayerState previous, PlayerState current) : base (PlayerEvent.StateChange)
+ {
+ this.previous = previous;
+ this.current = current;
+ }
+ }
+
+ public class PlayerEventErrorArgs : PlayerEventArgs
+ {
+ private string message;
+ public string Message {
+ get { return message; }
+ }
+
+ public PlayerEventErrorArgs (string message) : base (PlayerEvent.Error)
+ {
+ this.message = message;
+ }
+ }
+
+ public sealed class PlayerEventBufferingArgs : PlayerEventArgs
+ {
+ private double progress;
+ public double Progress {
+ get { return progress; }
+ }
+
+ public PlayerEventBufferingArgs (double progress) : base (PlayerEvent.Buffering)
+ {
+ this.progress = progress;
+ }
+ }
+
+ // WARNING: If you add events to the list below, you MUST update the
+ // "all" mask in PlayerEngineService.cs to reflect your addition!
+
+ [Flags]
+ public enum PlayerEvent
+ {
+ None = 0,
+ Iterate = 1,
+ StateChange = 2,
+ StartOfStream = 4,
+ EndOfStream = 8,
+ Buffering = 16,
+ Seek = 32,
+ Error = 64,
+ Volume = 128,
+ Metadata = 256,
+ TrackInfoUpdated = 512
+ }
+
+ public enum PlayerState
+ {
+ NotReady,
+ Ready,
+ Idle,
+ Contacting,
+ Loaded,
+ Playing,
+ Paused
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs Fri May 2 17:47:12 2008
@@ -83,7 +83,7 @@
player_engine = ServiceManager.PlayerEngine;
player_engine.PlayWhenIdleRequest += OnPlayerEnginePlayWhenIdleRequest;
- player_engine.EventChanged += OnPlayerEngineEventChanged;
+ player_engine.ConnectEvent (OnPlayerEvent, PlayerEvent.EndOfStream | PlayerEvent.StartOfStream, true);
}
protected virtual void InstantiateStacks ()
@@ -97,10 +97,10 @@
Next ();
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
switch (args.Event) {
- case PlayerEngineEvent.EndOfStream:
+ case PlayerEvent.EndOfStream:
if (!StopWhenFinished) {
if (RepeatMode == PlaybackRepeatMode.RepeatSingle) {
QueuePlayTrack ();
@@ -113,7 +113,7 @@
StopWhenFinished = false;
break;
- case PlayerEngineEvent.StartOfStream:
+ case PlayerEvent.StartOfStream:
TrackInfo track = player_engine.CurrentTrack;
if (changing_to_track != track && track != null) {
CurrentTrack = track;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp Fri May 2 17:47:12 2008
@@ -30,8 +30,7 @@
<File name="Banshee.Sources/ISource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.ServiceStack/ServiceStartedHandler.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.MediaEngine/PlayerEngine.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.MediaEngine/PlayerEngineState.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.MediaEngine/PlayerEngineEvent.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.MediaEngine/PlayerEvent.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/AlbumListModel.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/ArtistListModel.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/ExportableModel.cs" subtype="Code" buildaction="Compile" />
Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am Fri May 2 17:47:12 2008
@@ -62,9 +62,8 @@
Banshee.MediaEngine/ITranscoder.cs \
Banshee.MediaEngine/NullPlayerEngine.cs \
Banshee.MediaEngine/PlayerEngine.cs \
- Banshee.MediaEngine/PlayerEngineEvent.cs \
+ Banshee.MediaEngine/PlayerEvent.cs \
Banshee.MediaEngine/PlayerEngineService.cs \
- Banshee.MediaEngine/PlayerEngineState.cs \
Banshee.MediaEngine/TranscoderService.cs \
Banshee.MediaProfiles/MediaProfileManager.cs \
Banshee.MediaProfiles/Pipeline.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs Fri May 2 17:47:12 2008
@@ -58,7 +58,7 @@
ServiceManager.PlaybackController.Next ();
};
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.TrackInfoUpdated);
}
protected override bool OnFocusInEvent(Gdk.EventFocus evnt)
@@ -73,13 +73,11 @@
return base.OnFocusOutEvent(evnt);
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- if (args.Event == PlayerEngineEvent.TrackInfoUpdated) {
- // TODO: a) Figure out if the track that changed is actually in view
- // b) xfade the artwork if it is, that'd be slick
- QueueDraw ();
- }
+ // TODO: a) Figure out if the track that changed is actually in view
+ // b) xfade the artwork if it is, that'd be slick
+ QueueDraw ();
}
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellPlaybackIndicator.cs Fri May 2 17:47:12 2008
@@ -79,7 +79,7 @@
}
Gdk.Pixbuf render_pixbuf = pixbuf;
- if (ServiceManager.PlayerEngine.CurrentState == PlayerEngineState.Paused) {
+ if (ServiceManager.PlayerEngine.CurrentState == PlayerState.Paused) {
render_pixbuf = pixbuf_paused;
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs Fri May 2 17:47:12 2008
@@ -83,7 +83,7 @@
RulesHint = true;
RowSensitivePropertyName = "CanPlay";
- ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StateChange);
if (ServiceManager.Contains<GtkElementsService> ()) {
ServiceManager.Get<GtkElementsService> ().ThemeChanged += delegate {
@@ -111,7 +111,7 @@
return true;
}
- private void OnPlayerEngineStateChanged (object o, PlayerEngineStateArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
QueueDraw ();
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs Fri May 2 17:47:12 2008
@@ -56,8 +56,12 @@
BuildSeekSlider (layout);
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
- ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.Iterate |
+ PlayerEvent.Buffering |
+ PlayerEvent.StartOfStream |
+ PlayerEvent.StateChange);
+
seek_slider.SeekRequested += OnSeekRequested;
}
@@ -94,43 +98,42 @@
Add (box);
}
- private void OnPlayerEngineStateChanged (object o, PlayerEngineStateArgs args)
- {
- switch (args.State) {
- case PlayerEngineState.Contacting:
- stream_position_label.IsContacting = true;
- seek_slider.SetIdle ();
- break;
- case PlayerEngineState.Loaded:
- seek_slider.Duration = ServiceManager.PlayerEngine.CurrentTrack.Duration.TotalSeconds;
- break;
- case PlayerEngineState.Idle:
- seek_slider.SetIdle ();
- stream_position_label.IsContacting = false;
- break;
- }
- }
-
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
switch (args.Event) {
- case PlayerEngineEvent.Iterate:
+ case PlayerEvent.Iterate:
OnPlayerEngineTick ();
break;
- case PlayerEngineEvent.StartOfStream:
+ case PlayerEvent.StartOfStream:
stream_position_label.IsBuffering = false;
seek_slider.CanSeek = true;
break;
- case PlayerEngineEvent.Buffering:
- if (args.BufferingPercent >= 1.0) {
+ case PlayerEvent.Buffering:
+ PlayerEventBufferingArgs buffering = (PlayerEventBufferingArgs)args;
+ if (buffering.Progress >= 1.0) {
stream_position_label.IsBuffering = false;
break;
}
stream_position_label.IsBuffering = true;
- stream_position_label.BufferingProgress = args.BufferingPercent;
+ stream_position_label.BufferingProgress = buffering.Progress;
seek_slider.SetIdle ();
break;
+ case PlayerEvent.StateChange:
+ switch (((PlayerEventStateChangeArgs)args).Current) {
+ case PlayerState.Contacting:
+ stream_position_label.IsContacting = true;
+ seek_slider.SetIdle ();
+ break;
+ case PlayerState.Loaded:
+ seek_slider.Duration = ServiceManager.PlayerEngine.CurrentTrack.Duration.TotalSeconds;
+ break;
+ case PlayerState.Idle:
+ seek_slider.SetIdle ();
+ stream_position_label.IsContacting = false;
+ break;
+ }
+ break;
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedVolumeButton.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedVolumeButton.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedVolumeButton.cs Fri May 2 17:47:12 2008
@@ -40,7 +40,7 @@
public ConnectedVolumeButton () : base ()
{
Volume = PlayerEngineService.VolumeSchema.Get ();
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.Volume);
}
public ConnectedVolumeButton (bool classic) : this ()
@@ -48,13 +48,11 @@
Classic = classic;
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- if (args.Event == PlayerEngineEvent.Volume) {
- emit_lock = true;
- Volume = ServiceManager.PlayerEngine.Volume;
- emit_lock = false;
- }
+ emit_lock = true;
+ Volume = ServiceManager.PlayerEngine.Volume;
+ emit_lock = false;
}
protected override void OnVolumeChanged ()
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs Fri May 2 17:47:12 2008
@@ -83,8 +83,10 @@
artwork_manager = ServiceManager.Get<ArtworkManager> ("ArtworkManager");
}
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
- ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.StartOfStream |
+ PlayerEvent.TrackInfoUpdated |
+ PlayerEvent.StateChange);
}
public override void Dispose ()
@@ -94,8 +96,7 @@
}
if (ServiceManager.PlayerEngine != null) {
- ServiceManager.PlayerEngine.EventChanged -= OnPlayerEngineEventChanged;
- ServiceManager.PlayerEngine.StateChanged -= OnPlayerEngineStateChanged;
+ ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
}
stage.Iteration -= OnStageIteration;
@@ -412,20 +413,18 @@
second_line_layout.Dispose ();
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- if (args.Event == PlayerEngineEvent.StartOfStream || args.Event == PlayerEngineEvent.TrackInfoUpdated) {
+ if (args.Event == PlayerEvent.StartOfStream || args.Event == PlayerEvent.TrackInfoUpdated) {
LoadCurrentTrack ();
- }
- }
-
- private void OnPlayerEngineStateChanged (object o, PlayerEngineStateArgs args)
- {
- if (args.State == PlayerEngineState.Idle && (incoming_track != null || incoming_pixbuf != null)) {
- if (idle_timeout_id > 0) {
- GLib.Source.Remove (idle_timeout_id);
- } else {
- GLib.Timeout.Add (100, IdleTimeout);
+ } else if (args.Event == PlayerEvent.StateChange) {
+ if ((incoming_track != null || incoming_pixbuf != null) ||
+ ((PlayerEventStateChangeArgs)args).Current == PlayerState.Idle) {
+ if (idle_timeout_id > 0) {
+ GLib.Source.Remove (idle_timeout_id);
+ } else {
+ GLib.Timeout.Add (100, IdleTimeout);
+ }
}
}
}
@@ -433,7 +432,7 @@
private bool IdleTimeout ()
{
if (ServiceManager.PlayerEngine.CurrentTrack == null ||
- ServiceManager.PlayerEngine.CurrentState == PlayerEngineState.Idle) {
+ ServiceManager.PlayerEngine.CurrentState == PlayerState.Idle) {
incoming_track = null;
incoming_pixbuf = null;
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs Fri May 2 17:47:12 2008
@@ -107,28 +107,49 @@
this["PreviousAction"].IconName = "media-skip-backward";
action_service = actionService;
- ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.Error |
+ PlayerEvent.EndOfStream |
+ PlayerEvent.StateChange);
repeat_actions = new PlaybackRepeatActions (actionService);
shuffle_actions = new PlaybackShuffleActions (actionService, this);
}
- private void OnPlayerEngineStateChanged (object o, PlayerEngineStateArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
+ {
+ switch (args.Event) {
+ case PlayerEvent.Error:
+ case PlayerEvent.EndOfStream:
+ ToggleAction stop_action = (ToggleAction) this["StopWhenFinishedAction"];
+ // Kinda lame, but we don't want to actually reset StopWhenFinished inside the controller
+ // since it is also listening to EOS and needs to actually stop playback; we listen here
+ // just to keep the UI in sync.
+ stop_action.Activated -= OnStopWhenFinishedAction;
+ stop_action.Active = false;
+ stop_action.Activated += OnStopWhenFinishedAction;
+ break;
+ case PlayerEvent.StateChange:
+ OnPlayerStateChange ((PlayerEventStateChangeArgs)args);
+ break;
+ }
+ }
+
+ private void OnPlayerStateChange (PlayerEventStateChangeArgs args)
{
if (play_pause_action == null) {
play_pause_action = action_service["Playback.PlayPauseAction"];
}
- switch (args.State) {
- case PlayerEngineState.Contacting:
- case PlayerEngineState.Playing:
+ switch (args.Current) {
+ case PlayerState.Contacting:
+ case PlayerState.Playing:
ShowPlayAction ();
break;
- case PlayerEngineState.Paused:
+ case PlayerState.Paused:
ShowPlay ();
break;
- case PlayerEngineState.Idle:
+ case PlayerState.Idle:
ShowPlay ();
break;
default:
@@ -153,23 +174,6 @@
this["SeekToAction"].Sensitive = false;
}
}
-
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
- {
- switch (args.Event) {
- case PlayerEngineEvent.Error:
- case PlayerEngineEvent.EndOfStream:
-
- ToggleAction stop_action = (ToggleAction) this["StopWhenFinishedAction"];
- // Kinda lame, but we don't want to actually reset StopWhenFinished inside the controller
- // since it is also listening to EOS and needs to actually stop playback; we listen here
- // just to keep the UI in sync.
- stop_action.Activated -= OnStopWhenFinishedAction;
- stop_action.Active = false;
- stop_action.Activated += OnStopWhenFinishedAction;
- break;
- }
- }
private void ShowPlayAction ()
{
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs Fri May 2 17:47:12 2008
@@ -80,15 +80,16 @@
Catalog.GetString ("Toggle display of album cover art"), null, false),
});
- ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StateChange);
action_service = actionService;
OnFullScreen (null, EventArgs.Empty);
}
- private void OnPlayerEngineStateChanged (object o, PlayerEngineStateArgs args)
- {
- if (args.State == PlayerEngineState.Ready && !ServiceManager.PlayerEngine.SupportsEqualizer) {
+ private void OnPlayerEvent (PlayerEventArgs args)
+ {
+ if (((PlayerEventStateChangeArgs)args).Current == PlayerState.Ready &&
+ !ServiceManager.PlayerEngine.SupportsEqualizer) {
action_service["View.ShowEqualizerAction"].Sensitive = false;
}
}
Modified: trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Bookmarks/Banshee.Bookmarks/BookmarksService.cs Fri May 2 17:47:12 2008
@@ -255,13 +255,13 @@
DatabaseTrackInfo current_track = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo;
if (track != null) {
if (current_track == null || current_track.TrackId != track.TrackId) {
- ServiceManager.PlayerEngine.StateChanged += HandleStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (HandleStateChanged, PlayerEvent.StateChange);
ServiceManager.PlayerEngine.OpenPlay (track);
} else {
if (ServiceManager.PlayerEngine.CanSeek) {
ServiceManager.PlayerEngine.Position = position;
} else {
- ServiceManager.PlayerEngine.StateChanged += HandleStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (HandleStateChanged, PlayerEvent.StateChange);
ServiceManager.PlayerEngine.Play ();
}
}
@@ -270,10 +270,10 @@
}
}
- private void HandleStateChanged (object sender, PlayerEngineStateArgs args)
+ private void HandleStateChanged (PlayerEventArgs args)
{
- if (args.State == PlayerEngineState.Playing) {
- ServiceManager.PlayerEngine.StateChanged -= HandleStateChanged;
+ if (((PlayerEventStateChangeArgs)args).Current == PlayerState.Playing) {
+ ServiceManager.PlayerEngine.DisconnectEvent (HandleStateChanged);
if (!ServiceManager.PlayerEngine.CurrentTrack.IsLive) {
// Sleep in 5ms increments for at most 250ms waiting for CanSeek to be true
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs Fri May 2 17:47:12 2008
@@ -101,10 +101,15 @@
// Update the Visit action menu item if we update our account info
LastfmCore.Account.Updated += delegate (object o, EventArgs args) {
- actions["AudioscrobblerVisitAction"].Sensitive = LastfmCore.Account.UserName != null && LastfmCore.Account.CryptedPassword != null;
+ actions["AudioscrobblerVisitAction"].Sensitive = LastfmCore.Account.UserName != null
+ && LastfmCore.Account.CryptedPassword != null;
};
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.StartOfStream |
+ PlayerEvent.EndOfStream |
+ PlayerEvent.Seek |
+ PlayerEvent.Iterate);
action_service = ServiceManager.Get<InterfaceActionService> ("InterfaceActionService");
InterfaceInitialize ();
@@ -149,7 +154,7 @@
Queue (ServiceManager.PlayerEngine.CurrentTrack);
}
- ServiceManager.PlayerEngine.EventChanged -= OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
// When we stop the connection, queue ends up getting saved too, so the
// track we queued earlier should stay until next session.
@@ -227,10 +232,10 @@
}
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
switch (args.Event) {
- case PlayerEngineEvent.StartOfStream:
+ case PlayerEvent.StartOfStream:
// Queue the previous track in case of a skip
Queue (last_track);
@@ -243,11 +248,11 @@
break;
- case PlayerEngineEvent.Seek:
+ case PlayerEvent.Seek:
st.SkipPosition ();
break;
- case PlayerEngineEvent.Iterate:
+ case PlayerEvent.Iterate:
// Queue as now playing
if (!now_playing_sent && iterate_countdown == 0) {
if (last_track != null && last_track.Duration.TotalSeconds > 30 &&
@@ -266,7 +271,7 @@
st.IncreasePosition ();
break;
- case PlayerEngineEvent.EndOfStream:
+ case PlayerEvent.EndOfStream:
Queue (ServiceManager.PlayerEngine.CurrentTrack);
iterate_countdown = 4 * 4;
break;
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs Fri May 2 17:47:12 2008
@@ -62,7 +62,9 @@
action_service = ServiceManager.Get<InterfaceActionService> ();
this.lastfm = lastfm;
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.StartOfStream |
+ PlayerEvent.EndOfStream);
AddImportant (
new ActionEntry (
@@ -395,9 +397,9 @@
dialog.Destroy ();
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- if (args.Event == PlayerEngineEvent.EndOfStream || args.Event == PlayerEngineEvent.StartOfStream) {
+ if (args.Event == PlayerEvent.EndOfStream || args.Event == PlayerEvent.StartOfStream) {
TrackInfo current_track = ServiceManager.PlayerEngine.CurrentTrack;
this["LastfmLoveAction"].Visible = current_track is LastfmTrackInfo;
this["LastfmHateAction"].Visible = current_track is LastfmTrackInfo;
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs Fri May 2 17:47:12 2008
@@ -125,7 +125,7 @@
{
track_model = new MemoryTrackListModel ();
- ServiceManager.PlayerEngine.StateChanged += OnPlayerStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StateChange);
lastfm.Connection.StateChanged += HandleConnectionStateChanged;
Properties.SetString ("GtkActionPath", "/LastfmStationSourcePopup");
@@ -137,7 +137,7 @@
public void Dispose ()
{
- ServiceManager.PlayerEngine.StateChanged -= OnPlayerStateChanged;
+ ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
lastfm.Connection.StateChanged -= HandleConnectionStateChanged;
}
@@ -339,9 +339,10 @@
});
}
- private void OnPlayerStateChanged (object o, PlayerEngineStateArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- if (args.State == PlayerEngineState.Loaded && track_model.Contains (ServiceManager.PlayerEngine.CurrentTrack)) {
+ if (((PlayerEventStateChangeArgs)args).Current == PlayerState.Loaded &&
+ track_model.Contains (ServiceManager.PlayerEngine.CurrentTrack)) {
CurrentTrack = ServiceManager.PlayerEngine.CurrentTrack;
lock (track_model) {
Modified: trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs Fri May 2 17:47:12 2008
@@ -66,7 +66,7 @@
private InterfaceActionService interface_action_service;
private GtkElementsService elements_service;
private BaseClientWindow default_main_window;
-
+
private Glade.XML glade;
public MiniMode() : base(Catalog.GetString("Banshee Music Player"))
@@ -136,15 +136,17 @@
SetTip(repeat_toggle_button, Catalog.GetString("Change repeat playback mode"));
// Hook up everything
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
- ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.Error |
+ PlayerEvent.StateChange |
+ PlayerEvent.TrackInfoUpdated);
SetHeightLimit();
}
private void SetTip(Widget widget, string tip)
{
- TooltipSetter.Set (tooltip_host, widget, tip);
+ TooltipSetter.Set (tooltip_host, widget, tip);
}
private void SetHeightLimit()
@@ -182,27 +184,23 @@
// ---- Player Event Handlers ----
- private void OnPlayerEngineStateChanged(object o, Banshee.MediaEngine.PlayerEngineStateArgs args)
- {
- switch(args.State) {
- case PlayerEngineState.Loaded:
- UpdateMetaDisplay();
- break;
- case PlayerEngineState.Idle:
- InfoBox.Visible = false;
- UpdateMetaDisplay();
- break;
- }
- }
-
- private void OnPlayerEngineEventChanged(object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- switch(args.Event) {
- case PlayerEngineEvent.Error:
- UpdateMetaDisplay();
+ switch (args.Event) {
+ case PlayerEvent.Error:
+ case PlayerEvent.TrackInfoUpdated:
+ UpdateMetaDisplay ();
break;
- case PlayerEngineEvent.TrackInfoUpdated:
- UpdateMetaDisplay();
+ case PlayerEvent.StateChange:
+ switch (((PlayerEventStateChangeArgs)args).Current) {
+ case PlayerState.Loaded:
+ UpdateMetaDisplay ();
+ break;
+ case PlayerState.Idle:
+ InfoBox.Visible = false;
+ UpdateMetaDisplay ();
+ break;
+ }
break;
}
}
Modified: trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/GtkNotificationAreaBox.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/GtkNotificationAreaBox.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/GtkNotificationAreaBox.cs Fri May 2 17:47:12 2008
@@ -69,7 +69,7 @@
StatusIcon.PositionMenu (menu, out x, out y, out push_in, Handle);
}
- public void PlayerEngineEventChanged (PlayerEngineEventArgs args)
+ public void OnPlayerEvent (PlayerEventArgs args)
{
}
}
Modified: trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/INotificationAreaBox.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/INotificationAreaBox.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/INotificationAreaBox.cs Fri May 2 17:47:12 2008
@@ -40,7 +40,7 @@
event PopupMenuHandler PopupMenuEvent;
void PositionMenu (Menu menu, out int x, out int y, out bool push_in);
- void PlayerEngineEventChanged (PlayerEngineEventArgs args);
+ void OnPlayerEvent (PlayerEventArgs args);
Widget Widget { get; }
}
Modified: trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs Fri May 2 17:47:12 2008
@@ -156,7 +156,12 @@
}
}
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.Iterate |
+ PlayerEvent.StartOfStream |
+ PlayerEvent.EndOfStream |
+ PlayerEvent.TrackInfoUpdated |
+ PlayerEvent.StateChange);
// Forcefully load this
show_notifications = ShowNotifications;
@@ -177,7 +182,7 @@
notif_area = null;
}
- ServiceManager.PlayerEngine.EventChanged -= OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
elements_service.PrimaryWindowClose = null;
@@ -303,27 +308,27 @@
ShowNotifications = ((ToggleAction)actions["ToggleNotificationsAction"]).Active;
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
switch (args.Event) {
- case PlayerEngineEvent.Iterate:
+ case PlayerEvent.Iterate:
if (current_track != ServiceManager.PlayerEngine.CurrentTrack) {
current_track = ServiceManager.PlayerEngine.CurrentTrack;
ShowTrackNotification ();
}
break;
- case PlayerEngineEvent.StartOfStream:
- case PlayerEngineEvent.TrackInfoUpdated:
+ case PlayerEvent.StartOfStream:
+ case PlayerEvent.TrackInfoUpdated:
ToggleRatingMenuSensitive ();
ShowTrackNotification ();
break;
- case PlayerEngineEvent.EndOfStream:
+ case PlayerEvent.EndOfStream:
current_track = null;
ToggleRatingMenuSensitive ();
break;
}
- notif_area.PlayerEngineEventChanged (args);
+ notif_area.OnPlayerEvent (args);
}
private void OnItemRatingActivated (object o, EventArgs args)
Modified: trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs Fri May 2 17:47:12 2008
@@ -233,10 +233,10 @@
HidePopup ();
}
- public void PlayerEngineEventChanged (PlayerEngineEventArgs args)
+ public void OnPlayerEvent (PlayerEventArgs args)
{
switch (args.Event) {
- case PlayerEngineEvent.Iterate:
+ case PlayerEvent.Iterate:
if (popup != null) {
if (ServiceManager.PlayerEngine.CurrentTrack != null) {
popup.Duration = (uint)ServiceManager.PlayerEngine.CurrentTrack.Duration.TotalSeconds;
@@ -248,14 +248,14 @@
}
break;
- case PlayerEngineEvent.StartOfStream:
+ case PlayerEvent.StartOfStream:
can_show_popup = true;
break;
- case PlayerEngineEvent.EndOfStream:
+ case PlayerEvent.EndOfStream:
// only hide the popup when we don't play again after 250ms
GLib.Timeout.Add (250, delegate {
- if (ServiceManager.PlayerEngine.CurrentState != PlayerEngineState.Playing) {
+ if (ServiceManager.PlayerEngine.CurrentState != PlayerState.Playing) {
can_show_popup = false;
HidePopup ();
}
Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs Fri May 2 17:47:12 2008
@@ -42,7 +42,9 @@
public VideoDisplay ()
{
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.StartOfStream |
+ PlayerEvent.EndOfStream);
ToggleIdleVisibility ();
}
@@ -53,7 +55,7 @@
protected override void OnDestroyed ()
{
base.OnDestroyed ();
- ServiceManager.PlayerEngine.EventChanged -= OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
}
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
@@ -82,14 +84,9 @@
return true;
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- switch (args.Event) {
- case PlayerEngineEvent.StartOfStream:
- case PlayerEngineEvent.EndOfStream:
- ToggleIdleVisibility ();
- break;
- }
+ ToggleIdleVisibility ();
}
private void ToggleIdleVisibility ()
Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs Fri May 2 17:47:12 2008
@@ -68,7 +68,7 @@
((DatabaseTrackListModel)TrackModel).ForcedSortQuery = "CorePlaylistEntries.EntryID ASC";
- ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent);
ServiceManager.PlaybackController.Transition += OnCanonicalPlaybackControllerTransition;
ServiceManager.SourceManager.AddSource (this);
@@ -135,6 +135,8 @@
{
base.Dispose ();
+ ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
+
if (ClearOnQuitSchema.Get ()) {
OnClearPlayQueue (this, EventArgs.Empty);
}
@@ -178,11 +180,11 @@
}
}
- private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
- {
- if (args.Event == PlayerEngineEvent.EndOfStream) {
+ private void OnPlayerEvent (PlayerEventArgs args)
+ {
+ if (args.Event == PlayerEvent.EndOfStream) {
RemovePlayingTrack ();
- } else if (args.Event == PlayerEngineEvent.StartOfStream) {
+ } else if (args.Event == PlayerEvent.StartOfStream) {
if (this == ServiceManager.PlaybackController.Source) {
playing_track = ServiceManager.PlayerEngine.CurrentTrack as DatabaseTrackInfo;
} else {
Modified: trunk/banshee/src/Extensions/Extensions.mds
==============================================================================
--- trunk/banshee/src/Extensions/Extensions.mds (original)
+++ trunk/banshee/src/Extensions/Extensions.mds Fri May 2 17:47:12 2008
@@ -43,4 +43,4 @@
<Entry filename="Banshee.Sample/Banshee.Sample.mdp" />
<Entry filename="Banshee.BooScript/Banshee.BooScript.mdp" />
</Entries>
-</Combine>
+</Combine>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]