banshee r3036 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Core/Nereid/Nereid
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3036 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Core/Nereid/Nereid
- Date: Sun, 27 Jan 2008 02:02:59 +0000 (GMT)
Author: abock
Date: Sun Jan 27 02:02:59 2008
New Revision: 3036
URL: http://svn.gnome.org/viewvc/banshee?rev=3036&view=rev
Log:
2008-01-26 Aaron Bockover <abockover novell com>
Ladies, Gentlemen - I present to you playback against a dedicated source...
This has been probably in the top 3 requested features for the past 2 years
* src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs:
Perform all source operations from the public Source property; if no
Source has been manually set on the controller, use the default one;
raise the new SourceChanged event when Source is set
* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs: Listen
to PlaybackController.SourceChanged to refresh the GUI
* src/Core/Nereid/Nereid/PlayerInterface.cs: Set the source on the
playback controller to the active source when the user manually
plays a song
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs Sun Jan 27 02:02:59 2008
@@ -57,7 +57,6 @@
private bool stop_when_finished = false;
private PlayerEngineService player_engine;
- private SourceManager source_manager;
private ITrackModelSource source;
public event EventHandler Stopped;
@@ -68,12 +67,11 @@
remove { dbus_stopped -= value; }
}
+ public event EventHandler SourceChanged;
+
public PlaybackControllerService ()
{
InstantiateStacks ();
-
- source_manager = ServiceManager.SourceManager;
- source_manager.ActiveSourceChanged += OnActiveSourceChanged;
player_engine = ServiceManager.PlayerEngine;
player_engine.PlayWhenIdleRequest += OnPlayerEnginePlayWhenIdleRequest;
@@ -86,13 +84,6 @@
next_stack = new PlaybackControllerDatabaseStack ();
}
- private void OnActiveSourceChanged (SourceEventArgs args)
- {
- if (args.Source is ITrackModelSource) {
- Source = (ITrackModelSource)args.Source;
- }
- }
-
private void OnPlayerEnginePlayWhenIdleRequest (object o, EventArgs args)
{
Next ();
@@ -171,13 +162,13 @@
private TrackInfo QueryTrackLinear (Direction direction)
{
- int index = source.TrackModel.IndexOf (CurrentTrack);
- return source.TrackModel[index < 0 ? 0 : index + (direction == Direction.Next ? 1 : -1)];
+ int index = Source.TrackModel.IndexOf (CurrentTrack);
+ return Source.TrackModel[index < 0 ? 0 : index + (direction == Direction.Next ? 1 : -1)];
}
private TrackInfo QueryTrackRandom ()
{
- return source.TrackModel[random.Next (0, source.TrackModel.Count - 1)];
+ return Source.TrackModel[random.Next (0, Source.TrackModel.Count - 1)];
}
private void QueuePlayTrack ()
@@ -199,14 +190,33 @@
}
}
+ protected virtual void OnSourceChanged ()
+ {
+ EventHandler handler = SourceChanged;
+ if (handler != null) {
+ handler (this, EventArgs.Empty);
+ }
+ }
+
public TrackInfo CurrentTrack {
get { return current_track; }
protected set { current_track = value; }
}
public ITrackModelSource Source {
- get { return source; }
- set { source = value; }
+ get {
+ if (source == null && ServiceManager.SourceManager.DefaultSource is ITrackModelSource) {
+ return (ITrackModelSource)ServiceManager.SourceManager.DefaultSource;
+ }
+ return source;
+ }
+
+ set {
+ if (source != value) {
+ source = value;
+ OnSourceChanged ();
+ }
+ }
}
public PlaybackShuffleMode ShuffleMode {
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs Sun Jan 27 02:02:59 2008
@@ -109,6 +109,10 @@
QueueDraw();
};
+ ServiceManager.PlaybackController.SourceChanged += delegate {
+ QueueDraw ();
+ };
+
if(ServiceManager.Contains ("GtkElementsService")) {
ServiceManager.Get<Banshee.Gui.GtkElementsService> ("GtkElementsService").ThemeChanged += delegate {
QueueDraw();
Modified: trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs (original)
+++ trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs Sun Jan 27 02:02:59 2008
@@ -238,6 +238,13 @@
};
composite_view.TrackView.RowActivated += delegate (object o, RowActivatedArgs<TrackInfo> args) {
+ // Set the source from which to play to the current source since
+ // the user manually began playback from this source
+ Source source = ServiceManager.SourceManager.ActiveSource;
+ if (source is ITrackModelSource) {
+ ServiceManager.PlaybackController.Source = (ITrackModelSource)source;
+ }
+
ServiceManager.PlayerEngine.OpenPlay (args.RowValue);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]