banshee r3594 - in trunk/banshee: . src/Extensions/Banshee.AudioCd/Banshee.AudioCd
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3594 - in trunk/banshee: . src/Extensions/Banshee.AudioCd/Banshee.AudioCd
- Date: Sun, 30 Mar 2008 00:49:39 +0000 (GMT)
Author: abock
Date: Sun Mar 30 00:49:38 2008
New Revision: 3594
URL: http://svn.gnome.org/viewvc/banshee?rev=3594&view=rev
Log:
2008-03-29 Aaron Bockover <abock gnome org>
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs:
Remove all AudioCdSources when disposing the service and clear the map
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs:
If the disc is playing, tell the player engine that track information was
updated after the metadata is loaded from MB; disable all tracks when
ejecting so they can't be played while the eject is in progress
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs Sun Mar 30 00:49:38 2008
@@ -37,7 +37,7 @@
{
public class AudioCdService : IExtensionService, IDisposable
{
- private Dictionary<string, AudioCdSource> sources = new Dictionary<string, AudioCdSource> ();
+ private Dictionary<string, AudioCdSource> sources;
public AudioCdService ()
{
@@ -45,18 +45,31 @@
public void Initialize ()
{
- foreach (ICdromDevice device in ServiceManager.HardwareManager.GetAllCdromDevices ()) {
- MapCdromDevice (device);
+ lock (this) {
+ sources = new Dictionary<string, AudioCdSource> ();
+
+ foreach (ICdromDevice device in ServiceManager.HardwareManager.GetAllCdromDevices ()) {
+ MapCdromDevice (device);
+ }
+
+ ServiceManager.HardwareManager.DeviceAdded += OnHardwareDeviceAdded;
+ ServiceManager.HardwareManager.DeviceRemoved += OnHardwareDeviceRemoved;
}
-
- ServiceManager.HardwareManager.DeviceAdded += OnHardwareDeviceAdded;
- ServiceManager.HardwareManager.DeviceRemoved += OnHardwareDeviceRemoved;
}
public void Dispose ()
{
- ServiceManager.HardwareManager.DeviceAdded -= OnHardwareDeviceAdded;
- ServiceManager.HardwareManager.DeviceRemoved -= OnHardwareDeviceRemoved;
+ lock (this) {
+ ServiceManager.HardwareManager.DeviceAdded -= OnHardwareDeviceAdded;
+ ServiceManager.HardwareManager.DeviceRemoved -= OnHardwareDeviceRemoved;
+
+ foreach (AudioCdSource source in sources.Values) {
+ ServiceManager.SourceManager.RemoveSource (source);
+ }
+
+ sources.Clear ();
+ sources = null;
+ }
}
private void MapCdromDevice (ICdromDevice device)
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs Sun Mar 30 00:49:38 2008
@@ -63,6 +63,13 @@
get { return disc_model.Duration; }
}
+ public bool DiscIsPlaying {
+ get {
+ AudioCdTrackInfo playing_track = ServiceManager.PlayerEngine.CurrentTrack as AudioCdTrackInfo;
+ return playing_track != null && playing_track.Model == disc_model;
+ }
+ }
+
public void Dispose ()
{
ClearMessages ();
@@ -105,6 +112,9 @@
if (disc_model.MetadataQuerySuccess) {
DestroyQueryMessage ();
+ if (DiscIsPlaying) {
+ ServiceManager.PlayerEngine.TrackInfoUpdated ();
+ }
return;
}
@@ -202,11 +212,16 @@
public bool Unmap ()
{
- AudioCdTrackInfo playing_track = ServiceManager.PlayerEngine.CurrentTrack as AudioCdTrackInfo;
- if (playing_track != null && playing_track.Model == disc_model) {
+ if (DiscIsPlaying) {
ServiceManager.PlayerEngine.Close ();
}
+ foreach (TrackInfo track in disc_model) {
+ track.CanPlay = false;
+ }
+
+ OnUpdated ();
+
SourceMessage eject_message = new SourceMessage (this);
eject_message.FreezeNotify ();
eject_message.IsSpinning = true;
@@ -231,6 +246,11 @@
eject_message.SetIconName ("dialog-error");
eject_message.Text = String.Format (Catalog.GetString ("Could not eject audio CD: {0}"), e.Message);
PushMessage (eject_message);
+
+ foreach (TrackInfo track in disc_model) {
+ track.CanPlay = true;
+ }
+ OnUpdated ();
});
Log.Exception (e);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]