banshee r3578 - in trunk/banshee: . src/Backends/Banshee.Hal/Banshee.HalBackend src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Collection src/Core/Banshee.Services/Banshee.Hardware src/Core/Banshee.Services/Banshee.ServiceStack src/Extensions/Banshee.AudioCd src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Extensions/Banshee.Lastfm src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3578 - in trunk/banshee: . src/Backends/Banshee.Hal/Banshee.HalBackend src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Collection src/Core/Banshee.Services/Banshee.Hardware src/Core/Banshee.Services/Banshee.ServiceStack src/Extensions/Banshee.AudioCd src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Extensions/Banshee.Lastfm src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio
- Date: Fri, 28 Mar 2008 23:13:24 +0000 (GMT)
Author: abock
Date: Fri Mar 28 23:13:23 2008
New Revision: 3578
URL: http://svn.gnome.org/viewvc/banshee?rev=3578&view=rev
Log:
2008-03-28 Aaron Bockover <abock gnome org>
* src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs:
* src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs:
* src/Core/Banshee.Services/Banshee.Hardware/IHardwareManager.cs: Added
hardware add/remove events and properly resolve the devices in the HAL
backend
* src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs: Resolve a
volume device manually if no parent is passed
* src/Core/Banshee.Services/Banshee.Collection/MemoryTrackListModel.cs:
Moved from Last.fm since it's useful for other sources; provides a
track model that uses an in-memory generic List for storage
* src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs:
Provide a property for easily accessing the HardwareManager
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDisc.cs: Empty
stub of the disc object we'll need soon
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs:
Implemented most of the service that manages disc sources from the
HardwareManager; awesome
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs:
Stubbed out most things we'll need in the audio CD source
* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs:
Use the MemoryTrackListModel object
Added:
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/MemoryTrackListModel.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDisc.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
Removed:
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmTrackListModel.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs
trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IHardwareManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs
trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp
trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am
Modified: trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs (original)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs Fri Mar 28 23:13:23 2008
@@ -38,11 +38,14 @@
{
private Hal.Manager manager;
+ public event DeviceAddedHandler DeviceAdded;
+ public event DeviceRemovedHandler DeviceRemoved;
+
public HardwareManager ()
{
manager = new Hal.Manager ();
- manager.DeviceAdded += OnDeviceAdded;
- manager.DeviceRemoved += OnDeviceRemoved;
+ manager.DeviceAdded += OnHalDeviceAdded;
+ manager.DeviceRemoved += OnHalDeviceRemoved;
}
public void Dispose ()
@@ -74,12 +77,41 @@
return GetAllBlockDevices<IDiskDevice> ();
}
- private void OnDeviceAdded (object o, Hal.DeviceAddedArgs args)
+ private void OnHalDeviceAdded (object o, Hal.DeviceAddedArgs args)
+ {
+ if (!args.Device.QueryCapability ("block")) {
+ return;
+ }
+
+ IDevice device = BlockDevice.Resolve<IBlockDevice> (manager, args.Device);
+ if (device == null) {
+ device = Volume.Resolve (null, manager, args.Device);
+ }
+
+ if (device != null) {
+ OnDeviceAdded (device);
+ }
+ }
+
+ private void OnHalDeviceRemoved (object o, Hal.DeviceRemovedArgs args)
+ {
+ OnDeviceRemoved (args.Udi);
+ }
+
+ private void OnDeviceAdded (IDevice device)
{
+ DeviceAddedHandler handler = DeviceAdded;
+ if (handler != null) {
+ handler (this, new DeviceAddedArgs (device));
+ }
}
- private void OnDeviceRemoved (object o, Hal.DeviceRemovedArgs args)
+ private void OnDeviceRemoved (string uuid)
{
+ DeviceRemovedHandler handler = DeviceRemoved;
+ if (handler != null) {
+ handler (this, new DeviceRemovedArgs (uuid));
+ }
}
}
}
Modified: trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs (original)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs Fri Mar 28 23:13:23 2008
@@ -40,7 +40,7 @@
return null;
}
- return parent is ICdromDevice
+ return (parent is ICdromDevice || (parent == null && device.QueryCapability ("volume.disc")))
? DiscVolume.Resolve (parent, manager, device)
: new Volume (parent, manager, device);
}
@@ -49,7 +49,7 @@
protected Volume (BlockDevice parent, Hal.Manager manager, Hal.Device device) : base (manager, device)
{
- this.parent = parent;
+ this.parent = parent ?? BlockDevice.Resolve<IBlockDevice> (manager, device.Parent);
}
public string MountPoint {
Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/MemoryTrackListModel.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/MemoryTrackListModel.cs Fri Mar 28 23:13:23 2008
@@ -0,0 +1,104 @@
+//
+// MemoryTrackListModell.cs
+//
+// Authors:
+// Gabriel Burt <gburt novell com>
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Banshee.Collection
+{
+ public class MemoryTrackListModel : TrackListModel, IEnumerable<TrackInfo>
+ {
+ private List<TrackInfo> tracks = new List<TrackInfo> ();
+
+ public MemoryTrackListModel () : base ()
+ {
+ }
+
+ public override void Clear ()
+ {
+ lock (this) {
+ tracks.Clear ();
+ }
+ }
+
+ public override void Reload ()
+ {
+ lock (this) {
+ OnReloaded ();
+ }
+ }
+
+ public void Add (TrackInfo track)
+ {
+ lock (this) {
+ tracks.Add (track);
+ }
+ }
+
+ public void Remove (TrackInfo track)
+ {
+ lock (this) {
+ tracks.Remove (track);
+ }
+ }
+
+ public bool Contains (TrackInfo track)
+ {
+ lock (this) {
+ return IndexOf (track) != -1;
+ }
+ }
+
+ public override TrackInfo this[int index] {
+ get { lock (this) { return (index < tracks.Count) ? tracks[index] : null; } }
+ }
+
+ public override int Count {
+ get { lock (this) { return tracks.Count; } }
+ }
+
+ public override int IndexOf (TrackInfo track)
+ {
+ lock (this) { return tracks.IndexOf (track); }
+ }
+
+ public IEnumerator<TrackInfo> GetEnumerator ()
+ {
+ foreach (TrackInfo track in tracks) {
+ yield return track;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs Fri Mar 28 23:13:23 2008
@@ -40,6 +40,16 @@
{
private IHardwareManager manager;
+ public event DeviceAddedHandler DeviceAdded {
+ add { manager.DeviceAdded += value; }
+ remove { manager.DeviceAdded -= value; }
+ }
+
+ public event DeviceRemovedHandler DeviceRemoved {
+ add { manager.DeviceRemoved += value; }
+ remove { manager.DeviceRemoved -= value; }
+ }
+
public HardwareManager ()
{
foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes ("/Banshee/Platform/HardwareManager")) {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IHardwareManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IHardwareManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IHardwareManager.cs Fri Mar 28 23:13:23 2008
@@ -33,8 +33,42 @@
{
public interface IHardwareManager : IDisposable
{
+ event DeviceAddedHandler DeviceAdded;
+ event DeviceRemovedHandler DeviceRemoved;
+
IEnumerable<IBlockDevice> GetAllBlockDevices ();
IEnumerable<ICdromDevice> GetAllCdromDevices ();
IEnumerable<IDiskDevice> GetAllDiskDevices ();
}
+
+ public delegate void DeviceAddedHandler (object o, DeviceAddedArgs args);
+ public delegate void DeviceRemovedHandler (object o, DeviceRemovedArgs args);
+
+ public sealed class DeviceAddedArgs : EventArgs
+ {
+ private IDevice device;
+
+ public DeviceAddedArgs (IDevice device)
+ {
+ this.device = device;
+ }
+
+ public IDevice Device {
+ get { return device; }
+ }
+ }
+
+ public sealed class DeviceRemovedArgs : EventArgs
+ {
+ private string device_uuid;
+
+ public DeviceRemovedArgs (string deviceUuid)
+ {
+ this.device_uuid = deviceUuid;
+ }
+
+ public string DeviceUuid {
+ get { return device_uuid; }
+ }
+ }
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs Fri Mar 28 23:13:23 2008
@@ -40,6 +40,7 @@
using Banshee.MediaEngine;
using Banshee.PlaybackController;
using Banshee.Library;
+using Banshee.Hardware;
namespace Banshee.ServiceStack
{
@@ -281,5 +282,9 @@
public static PlaybackControllerService PlaybackController {
get { return (PlaybackControllerService)Get ("PlaybackController"); }
}
+
+ public static HardwareManager HardwareManager {
+ get { return Get<HardwareManager> (); }
+ }
}
}
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 Mar 28 23:13:23 2008
@@ -140,6 +140,7 @@
<File name="Banshee.Hardware/ICdromDevice.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Hardware/IDiskDevice.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Hardware/IDiscVolume.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Collection/MemoryTrackListModel.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
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 Mar 28 23:13:23 2008
@@ -24,6 +24,7 @@
Banshee.Collection/IHasTrackSelection.cs \
Banshee.Collection/ImportEventHandler.cs \
Banshee.Collection/ImportManager.cs \
+ Banshee.Collection/MemoryTrackListModel.cs \
Banshee.Collection/ModelHelper.cs \
Banshee.Collection/SelectAllSelection.cs \
Banshee.Collection/TrackListModel.cs \
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd.mdp Fri Mar 28 23:13:23 2008
@@ -9,8 +9,9 @@
</Configurations>
<Contents>
<File name="Banshee.AudioCd.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
- <File name="Banshee.AudioCd" subtype="Directory" buildaction="Compile" />
<File name="Banshee.AudioCd/AudioCdService.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.AudioCd/AudioCdSource.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.AudioCd/AudioCdDisc.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
Added: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDisc.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDisc.cs Fri Mar 28 23:13:23 2008
@@ -0,0 +1,56 @@
+//
+// AudioCdDisc.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using Banshee.Hardware;
+
+namespace Banshee.AudioCd
+{
+ public class AudioCdDisc
+ {
+ private IDiscVolume volume;
+
+ public AudioCdDisc (IDiscVolume volume)
+ {
+ this.volume = volume;
+ }
+
+ public IDiscVolume Volume {
+ get { return volume; }
+ }
+
+ public string Title {
+ get { return "New CD"; }
+ }
+
+ public int TrackCount {
+ get { return 0; }
+ }
+ }
+}
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 Fri Mar 28 23:13:23 2008
@@ -27,7 +27,9 @@
//
using System;
+using System.Collections.Generic;
+using Hyena;
using Banshee.ServiceStack;
using Banshee.Hardware;
@@ -35,16 +37,79 @@
{
public class AudioCdService : IExtensionService, IDisposable
{
+ private Dictionary<string, AudioCdSource> sources = new Dictionary<string, AudioCdSource> ();
+
public AudioCdService ()
{
}
public void Initialize ()
{
+ foreach (ICdromDevice device in ServiceManager.HardwareManager.GetAllCdromDevices ()) {
+ MapCdromDevice (device);
+ }
+
+ ServiceManager.HardwareManager.DeviceAdded += OnHardwareDeviceAdded;
+ ServiceManager.HardwareManager.DeviceRemoved += OnHardwareDeviceRemoved;
}
public void Dispose ()
{
+ ServiceManager.HardwareManager.DeviceAdded -= OnHardwareDeviceAdded;
+ ServiceManager.HardwareManager.DeviceRemoved -= OnHardwareDeviceRemoved;
+ }
+
+ private void MapCdromDevice (ICdromDevice device)
+ {
+ lock (this) {
+ foreach (IVolume volume in device) {
+ if (volume is IDiscVolume) {
+ MapDiscVolume ((IDiscVolume)volume);
+ }
+ }
+ }
+ }
+
+ private void MapDiscVolume (IDiscVolume volume)
+ {
+ lock (this) {
+ if (!sources.ContainsKey (volume.Uuid) && volume.HasAudio) {
+ AudioCdSource source = new AudioCdSource (new AudioCdDisc (volume));
+ sources.Add (volume.Uuid, source);
+ ServiceManager.SourceManager.AddSource (source);
+ Log.DebugFormat ("Mapping audio CD ({0})", volume.Uuid);
+ }
+ }
+ }
+
+ private void UnmapDiscVolume (string uuid)
+ {
+ lock (this) {
+ if (sources.ContainsKey (uuid)) {
+ AudioCdSource source = sources[uuid];
+ ServiceManager.SourceManager.RemoveSource (source);
+ sources.Remove (uuid);
+ Log.DebugFormat ("Unmapping audio CD ({0})", uuid);
+ }
+ }
+ }
+
+ private void OnHardwareDeviceAdded (object o, DeviceAddedArgs args)
+ {
+ lock (this) {
+ if (args.Device is ICdromDevice) {
+ MapCdromDevice ((ICdromDevice)args.Device);
+ } else if (args.Device is IDiscVolume) {
+ MapDiscVolume ((IDiscVolume)args.Device);
+ }
+ }
+ }
+
+ private void OnHardwareDeviceRemoved (object o, DeviceRemovedArgs args)
+ {
+ lock (this) {
+ UnmapDiscVolume (args.DeviceUuid);
+ }
}
string IService.ServiceName {
Added: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs Fri Mar 28 23:13:23 2008
@@ -0,0 +1,148 @@
+//
+// AudioCdSource.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Mono.Unix;
+
+using Banshee.Sources;
+using Banshee.Collection;
+
+namespace Banshee.AudioCd
+{
+ public class AudioCdSource : Source, ITrackModelSource, IUnmapableSource, IDisposable
+ {
+ private AudioCdDisc disc;
+ private MemoryTrackListModel track_model;
+
+ public AudioCdSource (AudioCdDisc disc) : base (Catalog.GetString ("Audio CD"), disc.Title, 200)
+ {
+ this.disc = disc;
+
+ track_model = new MemoryTrackListModel ();
+
+ Properties.SetStringList ("Icon.Name", "media-cdrom", "gnome-dev-cdrom-audio", "source-cd-audio");
+ Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Eject Disc"));
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ public AudioCdDisc Disc {
+ get { return disc; }
+ }
+
+#region Source Overrides
+
+ public override void Rename (string newName)
+ {
+ base.Rename (newName);
+ }
+
+ public override bool CanSearch {
+ get { return false; }
+ }
+
+ protected override string TypeUniqueId {
+ get { return "audio-cd"; }
+ }
+
+ public override int Count {
+ get { return track_model.Count; }
+ }
+
+#endregion
+
+#region ITrackModelSource Implementation
+
+ public TrackListModel TrackModel {
+ get { return track_model; }
+ }
+
+ public AlbumListModel AlbumModel {
+ get { return null; }
+ }
+
+ public ArtistListModel ArtistModel {
+ get { return null; }
+ }
+
+ public void Reload ()
+ {
+ track_model.Reload ();
+ }
+
+ public void RemoveSelectedTracks ()
+ {
+ }
+
+ public void DeleteSelectedTracks ()
+ {
+ }
+
+ public bool CanRemoveTracks {
+ get { return false; }
+ }
+
+ public bool CanDeleteTracks {
+ get { return false; }
+ }
+
+ public bool ConfirmRemoveTracks {
+ get { return false; }
+ }
+
+ public bool ShowBrowser {
+ get { return false; }
+ }
+
+ public bool HasDependencies {
+ get { return false; }
+ }
+
+#endregion
+
+#region IUnmapableSource Implementation
+
+ public bool Unmap ()
+ {
+ return true;
+ }
+
+ public bool CanUnmap {
+ get { return true; }
+ }
+
+ public bool ConfirmBeforeUnmap {
+ get { return false; }
+ }
+
+#endregion
+
+ }
+}
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Makefile.am Fri Mar 28 23:13:23 2008
@@ -3,7 +3,10 @@
LINK = $(REF_EXTENSION_AUDIOCD)
INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
-SOURCES = Banshee.AudioCd/AudioCdService.cs
+SOURCES = \
+ Banshee.AudioCd/AudioCdDisc.cs \
+ Banshee.AudioCd/AudioCdService.cs \
+ Banshee.AudioCd/AudioCdSource.cs
RESOURCES = Banshee.AudioCd.addin.xml
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 Mar 28 23:13:23 2008
@@ -54,7 +54,7 @@
{
private static string generic_name = Catalog.GetString ("Last.fm Station");
- private LastfmTrackListModel track_model;
+ private MemoryTrackListModel track_model;
private SourceMessage status_message;
private LastfmSource lastfm;
@@ -124,7 +124,7 @@
private void Initialize ()
{
- track_model = new LastfmTrackListModel ();
+ track_model = new MemoryTrackListModel ();
ServiceManager.PlayerEngine.StateChanged += OnPlayerStateChanged;
lastfm.Connection.StateChanged += HandleConnectionStateChanged;
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.mdp Fri Mar 28 23:13:23 2008
@@ -12,7 +12,6 @@
<File name="Banshee.Lastfm.Radio/LastfmSource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Lastfm.Radio/LastfmSourceContents.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Lastfm.Radio/LastfmTrackInfo.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.Lastfm.Radio/LastfmTrackListModel.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Lastfm.Radio/StationEditor.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Lastfm.Radio/StationSource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Lastfm.Radio/StationType.cs" subtype="Code" buildaction="Compile" />
Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Makefile.am Fri Mar 28 23:13:23 2008
@@ -10,7 +10,6 @@
Banshee.Lastfm.Radio/LastfmSource.cs \
Banshee.Lastfm.Radio/LastfmSourceContents.cs \
Banshee.Lastfm.Radio/LastfmTrackInfo.cs \
- Banshee.Lastfm.Radio/LastfmTrackListModel.cs \
Banshee.Lastfm.Radio/StationEditor.cs \
Banshee.Lastfm.Radio/StationSource.cs \
Banshee.Lastfm.Radio/StationType.cs
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]