banshee r3573 - in trunk/banshee: . build src/Backends src/Backends/Banshee.Hal src/Backends/Banshee.Hal/Banshee.HalBackend src/Backends/Banshee.Hal/Hal src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Hardware



Author: abock
Date: Fri Mar 28 01:46:33 2008
New Revision: 3573
URL: http://svn.gnome.org/viewvc/banshee?rev=3573&view=rev

Log:
2008-03-27  Aaron Bockover  <abock gnome org>

    * src/Backends/Banshee.Hal: First pass at the HAL implementation for the
    new hardware layer; very incomplete

    * src/Core/Banshee.Services/Banshee.Hardware/IHardwareManager.cs:
    * src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs: Filled
    out some functionality; GetAllBlockDevices, GetAllCdromDevices, and
    GetAllDiskDevices

    * src/Core/Banshee.Services/Banshee.Hardware/IBlockDevice.cs:
    * src/Core/Banshee.Services/Banshee.Hardware/ICdromDevice.cs:
    * src/Core/Banshee.Services/Banshee.Hardware/IDevice.cs:
    * src/Core/Banshee.Services/Banshee.Hardware/IDiscVolume.cs:
    * src/Core/Banshee.Services/Banshee.Hardware/IDiskDevice.cs:
    * src/Core/Banshee.Services/Banshee.Hardware/IVolume.cs: Stubbed out
    more interfaces for the hardware object model

    * src/Core/Banshee.Services/Banshee.Services.addin.xml: Added the
    hardware manager extension point



Added:
   trunk/banshee/src/Backends/Banshee.Hal/
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.Hal.addin.xml
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.Hal.mdp
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/BlockDevice.cs
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/CdromDevice.cs
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/Device.cs
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/DiskDevice.cs
   trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs
   trunk/banshee/src/Backends/Banshee.Hal/Hal/
   trunk/banshee/src/Backends/Banshee.Hal/Hal/Device.cs
   trunk/banshee/src/Backends/Banshee.Hal/Hal/Manager.cs
   trunk/banshee/src/Backends/Banshee.Hal/Hal/Volume.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/ICdromDevice.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDiscVolume.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDiskDevice.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/build/build.environment.mk
   trunk/banshee/configure.ac
   trunk/banshee/src/Backends/Backends.mds
   trunk/banshee/src/Backends/Makefile.am
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/HardwareManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IBlockDevice.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDevice.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IHardwareManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IVolume.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
   trunk/banshee/src/Core/Banshee.Services/Makefile.am

Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk	(original)
+++ trunk/banshee/build/build.environment.mk	Fri Mar 28 01:46:33 2008
@@ -117,6 +117,7 @@
 REF_BACKEND_GNOME = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_GCONF) $(LINK_GNOME)
 REF_BACKEND_GSTREAMER = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_GLIB)
 REF_BACKEND_UNIX = $(LINK_BANSHEE_CORE_DEPS) $(LINK_MONO_POSIX)
+REF_BACKEND_HAL = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_DBUS)
 
 # Extensions
 REF_EXTENSION_BOOKMARKS = $(LINK_BANSHEE_THICKCLIENT_DEPS)

Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac	(original)
+++ trunk/banshee/configure.ac	Fri Mar 28 01:46:33 2008
@@ -143,6 +143,7 @@
 src/Backends/Makefile
 src/Backends/Banshee.Gnome/Makefile
 src/Backends/Banshee.GStreamer/Makefile
+src/Backends/Banshee.Hal/Makefile
 src/Backends/Banshee.Unix/Makefile
 
 src/Libraries/Makefile

Modified: trunk/banshee/src/Backends/Backends.mds
==============================================================================
--- trunk/banshee/src/Backends/Backends.mds	(original)
+++ trunk/banshee/src/Backends/Backends.mds	Fri Mar 28 01:46:33 2008
@@ -4,16 +4,19 @@
       <Entry build="True" name="Banshee.GStreamer" configuration="Debug" />
       <Entry build="True" name="Banshee.Gnome" configuration="Debug" />
       <Entry build="True" name="Banshee.Unix" configuration="Debug" />
+      <Entry build="True" name="Banshee.Hal" configuration="Debug" />
     </Configuration>
   </Configurations>
   <StartMode startupentry="Banshee.GStreamer" single="True">
     <Execute type="None" entry="Banshee.GStreamer" />
     <Execute type="None" entry="Banshee.Gnome" />
     <Execute type="None" entry="Banshee.Unix" />
+    <Execute type="None" entry="Banshee.Hal" />
   </StartMode>
   <Entries>
     <Entry filename="Banshee.GStreamer/Banshee.GStreamer.mdp" />
     <Entry filename="Banshee.Gnome/Banshee.Gnome.mdp" />
     <Entry filename="Banshee.Unix/Banshee.Unix.mdp" />
+    <Entry filename="Banshee.Hal/Banshee.Hal.mdp" />
   </Entries>
 </Combine>
\ No newline at end of file

Added: trunk/banshee/src/Backends/Banshee.Hal/Banshee.Hal.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.Hal.addin.xml	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin 
+    id="Banshee.Hal"
+    version="1.0"
+    compatVersion="1.0"
+    copyright="Â 2008 Novell Inc. Licensed under the MIT X11 license."
+    name="HAL Hardware Manager"
+    category="Platform"
+    description="Provides hardware support through HAL."
+    author="Aaron Bockover"
+    url="http://banshee-project.org/";
+    defaultEnabled="true">
+
+  <Dependencies>
+    <Addin id="Banshee.Services" version="1.0"/>
+  </Dependencies>
+
+  <Extension path="/Banshee/Platform/HardwareManager">
+    <HardwareManager class="Banshee.HalBackend.HardwareManager"/>
+  </Extension>
+
+</Addin>

Added: trunk/banshee/src/Backends/Banshee.Hal/Banshee.Hal.mdp
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.Hal.mdp	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,38 @@
+<Project name="Banshee.Hal" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.Hal" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
+      <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <Contents>
+    <File name="Banshee.HalBackend/HardwareManager.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hal/Device.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hal/Manager.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hal/Volume.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Hal.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Banshee.HalBackend/Device.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.HalBackend/BlockDevice.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.HalBackend/CdromDevice.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.HalBackend/DiskDevice.cs" subtype="Code" buildaction="Compile" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Services" />
+    <ProjectReference type="Project" localcopy="True" refto="Hyena" />
+    <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+    <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
+    <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus.GLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
+  </References>
+  <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
+    <BuildFilesVar Sync="True" Name="SOURCES" />
+    <DeployFilesVar />
+    <ResourcesVar Sync="True" Name="RESOURCES" />
+    <OthersVar />
+    <GacRefVar />
+    <AsmRefVar />
+    <ProjectRefVar />
+  </MonoDevelop.Autotools.MakefileInfo>
+</Project>
\ No newline at end of file

Added: trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/BlockDevice.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/BlockDevice.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,82 @@
+//
+// BlockDevice.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 System.Collections;
+using System.Collections.Generic;
+
+using Banshee.Hardware;
+
+namespace Banshee.HalBackend
+{
+    public abstract class BlockDevice : Device, IBlockDevice
+    {
+        public static BlockDevice Resolve<T> (Hal.Device device) where T : IBlockDevice
+        {
+            if (device["info.category"] == "storage" && device.QueryCapability ("block") && 
+                device.PropertyExists ("block.device")) {
+                if (typeof (T) == typeof (ICdromDevice)) {
+                    return CdromDevice.Resolve (device);
+                } else if (typeof (T) == typeof (IDiskDevice)) {
+                    return DiskDevice.Resolve (device);
+                }
+                
+                return (BlockDevice)CdromDevice.Resolve (device) ?? (BlockDevice)DiskDevice.Resolve (device);
+            }
+            
+            return null;
+        }
+        
+        internal BlockDevice (Hal.Device device) : base (device)
+        {
+        }
+        
+        public string DeviceNode {
+            get { return HalDevice.Udi; }
+        }
+        
+        public IEnumerable<IVolume> Volumes {
+            get { return this; }
+        }
+        
+        public IEnumerator<IVolume> GetEnumerator ()
+        {
+            return null;
+        }
+        
+        IEnumerator IEnumerable.GetEnumerator ()
+        {
+            return GetEnumerator ();
+        }
+        
+        public override string ToString ()
+        {
+            return DeviceNode;
+        }
+    }
+}

Added: trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/CdromDevice.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/CdromDevice.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,52 @@
+//
+// CdromDevice.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 System.Collections;
+using System.Collections.Generic;
+
+using Banshee.Hardware;
+
+namespace Banshee.HalBackend
+{
+    public class CdromDevice : BlockDevice, ICdromDevice
+    {
+        public new static CdromDevice Resolve (Hal.Device device)
+        {
+            if (device["storage.drive_type"] == "cdrom") {
+                return new CdromDevice (device);
+            }
+            
+            return null;
+        }
+        
+        internal CdromDevice (Hal.Device device) : base (device)
+        {
+        }
+    }
+}

Added: trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/Device.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/Device.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,55 @@
+//
+// Device.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.HalBackend
+{
+    public abstract class Device : IDevice
+    {    
+        private Hal.Device device;
+        protected Hal.Device HalDevice {
+            get { return device; }
+        }
+
+        internal Device (Hal.Device device)
+        {
+            this.device = device;
+        }
+        
+        public string Uuid {
+            get { return device.Udi; }
+        }
+
+        public virtual string Name {
+            get { return device["info.product"]; }
+        }
+    }
+}

Added: trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/DiskDevice.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/DiskDevice.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,52 @@
+//
+// DiskDevice.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 System.Collections;
+using System.Collections.Generic;
+
+using Banshee.Hardware;
+
+namespace Banshee.HalBackend
+{
+    public class DiskDevice : BlockDevice, IDiskDevice
+    {
+        public new static DiskDevice Resolve (Hal.Device device)
+        {
+            if (device["storage.drive_type"] == "disk") {
+                return new DiskDevice (device);
+            }
+            
+            return null;
+        }
+        
+        internal DiskDevice (Hal.Device device) : base (device)
+        {
+        }
+    }
+}

Added: trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,85 @@
+//
+// HardwareManager.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 System.Collections.Generic;
+
+using Hyena;
+using Banshee.Hardware;
+
+namespace Banshee.HalBackend
+{
+    public sealed class HardwareManager : IHardwareManager
+    {
+        private Hal.Manager manager;
+        
+        public HardwareManager ()
+        {
+            manager = new Hal.Manager ();
+            manager.DeviceAdded += OnDeviceAdded;
+            manager.DeviceRemoved += OnDeviceRemoved;
+        }
+        
+        public void Dispose ()
+        {
+        }
+        
+        private IEnumerable<T> GetAllBlockDevices<T> () where T : IBlockDevice
+        {
+            foreach (Hal.Device hal_device in manager.FindDeviceByCapabilityAsDevice ("block")) {
+                IBlockDevice device = BlockDevice.Resolve<T> (hal_device);
+                if (device != null) {
+                    yield return (T)device;
+                }
+            }
+        }
+        
+        public IEnumerable<IBlockDevice> GetAllBlockDevices ()
+        {
+            return GetAllBlockDevices<IBlockDevice> ();
+        }
+        
+        public IEnumerable<ICdromDevice> GetAllCdromDevices ()
+        {
+            return GetAllBlockDevices<ICdromDevice> ();
+        }
+        
+        public IEnumerable<IDiskDevice> GetAllDiskDevices ()
+        {
+            return GetAllBlockDevices<IDiskDevice> ();
+        }
+        
+        private void OnDeviceAdded (object o, Hal.DeviceAddedArgs args)
+        {
+        }
+        
+        private void OnDeviceRemoved (object o, Hal.DeviceRemovedArgs args)
+        {
+        }
+    }
+}

Added: trunk/banshee/src/Backends/Banshee.Hal/Hal/Device.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Hal/Device.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,398 @@
+//
+// Device.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-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;
+
+using NDesk.DBus;
+
+namespace Hal
+{
+    public struct PropertyModification
+    {
+        public string Key;
+        public bool Added;
+        public bool Removed;
+    }
+
+    internal delegate void DBusPropertyModifiedHandler(int modificationsLength, 
+        PropertyModification [] modifications);
+    
+    [Interface("org.freedesktop.Hal.Device")]
+    internal interface IDevice
+    {
+        // TODO:
+        // Need to support the Condition event, but it has a
+        // variable number of arguments, not currently supported
+        
+        event DBusPropertyModifiedHandler PropertyModified;
+    
+        void SetPropertyString(string key, string value);
+        void SetPropertyInteger(string key, int value);
+        void SetPropertyBoolean(string key, bool value);
+        void SetPropertyDouble(string key, double value);
+        void SetPropertyStringList(string key, string [] value);
+        
+        void SetProperty(string key, ulong value);
+        ulong GetProperty(string key); // nasty hack to get around the fact
+                                       // that HAL doesn't actually send this
+                                       // in a variant, nor does it have a 
+                                       // GetPropertyUInt64
+                                       // should be object GetProperty(string key)
+
+        void StringListPrepend(string key, string value);
+        void StringListAppend(string key, string value);
+        void StringListRemove(string key, string value);
+        
+        string GetPropertyString(string key);
+        int GetPropertyInteger(string key);
+        bool GetPropertyBoolean(string key);
+        double GetPropertyDouble(string key);
+        string [] GetPropertyStringList(string key);
+        
+        IDictionary<string, object> GetAllProperties();
+        void RemoveProperty(string key);
+        PropertyType GetPropertyType(string key);
+        bool PropertyExists(string key);
+        
+        void AddCapability(string capability);
+        bool QueryCapability(string capability);
+        void Lock(string reason);
+        void Unlock();
+    }
+    
+    internal enum DType : byte
+    {
+      Invalid = (byte)'\0',
+      Byte = (byte)'y',
+      Boolean = (byte)'b',
+      Int16 = (byte)'n',
+      UInt16 = (byte)'q',
+      Int32 = (byte)'i',
+      UInt32 = (byte)'u',
+      Int64 = (byte)'x',
+      UInt64 = (byte)'t',
+      Single = (byte)'f',
+      Double = (byte)'d',
+      String = (byte)'s',
+      ObjectPath = (byte)'o',
+      Signature = (byte)'g',
+      Array = (byte)'a',
+      Struct = (byte)'r',
+      DictEntry = (byte)'e',
+      Variant = (byte)'v',
+      StructBegin = (byte)'(',
+      StructEnd = (byte)')',
+      DictEntryBegin = (byte)'{',
+      DictEntryEnd = (byte)'}',
+    }
+    
+    public enum PropertyType
+    {
+        Invalid = DType.Invalid,
+        Int32 = DType.Int32,
+        UInt64 = DType.UInt64,
+        Double = DType.Double,
+        Boolean = DType.Boolean,
+        String = DType.String,
+        StrList = ((int)(DType.String << 8) + ('l')) 
+    }
+
+    public class PropertyModifiedArgs : EventArgs
+    {
+        private PropertyModification [] modifications;
+        
+        public PropertyModifiedArgs(PropertyModification [] modifications)
+        {
+            this.modifications = modifications;
+        }
+        
+        public PropertyModification [] Modifications {
+            get { return modifications; }
+        }
+    }
+
+    public delegate void PropertyModifiedHandler(object o, PropertyModifiedArgs args);
+
+    public class Device : IEnumerable<KeyValuePair<string, object>>, IEqualityComparer<Device>,
+        IEquatable<Device>, IComparer<Device>, IComparable<Device>
+    {
+        private string udi;
+        private IDevice device;
+        
+        public event PropertyModifiedHandler PropertyModified;
+        
+        public Device(string udi)
+        {
+            this.udi = udi;
+            
+            device = CastDevice<IDevice>();
+            device.PropertyModified += OnPropertyModified;
+        }
+        
+        public static Device [] UdisToDevices(string [] udis)
+        {
+            if(udis == null || udis.Length == 0) {
+                return new Device[0];
+            }
+            
+            Device [] devices = new Device[udis.Length];
+            for(int i = 0; i < udis.Length; i++) {
+                devices[i] = new Device(udis[i]);
+            }
+            
+            return devices;
+        }
+        
+        protected virtual void OnPropertyModified(int modificationsLength, PropertyModification [] modifications)
+        {
+            if(modifications.Length != modificationsLength) {
+                throw new ApplicationException("Number of modified properties does not match");
+            }
+        
+            PropertyModifiedHandler handler = PropertyModified;
+            if(handler != null) {
+                handler(this, new PropertyModifiedArgs(modifications));   
+            }
+        }
+        
+        public string [] GetChildren(Manager manager)
+        {
+            return manager.FindDeviceByStringMatch("info.parent", Udi);
+        }
+        
+        public Device [] GetChildrenAsDevice(Manager manager)
+        {
+            return manager.FindDeviceByStringMatchAsDevice("info.parent", Udi);
+        }
+        
+        public void Lock(string reason)
+        {
+            device.Lock(reason);
+        }
+        
+        public void Unlock()
+        {
+            device.Unlock();
+        }
+
+        public string GetPropertyString(string key)
+        {
+            return device.GetPropertyString(key);
+        }
+
+        public int GetPropertyInteger(string key)
+        {
+            return device.GetPropertyInteger(key);
+        }
+        
+        public ulong GetPropertyUInt64(string key)
+        {
+            return device.GetProperty(key);
+        }
+
+        public double GetPropertyDouble(string key)
+        {
+            return device.GetPropertyDouble(key);
+        }
+
+        public bool GetPropertyBoolean(string key)
+        {
+            return device.GetPropertyBoolean(key);
+        }
+
+        public string [] GetPropertyStringList(string key)
+        {
+            return device.GetPropertyStringList(key);
+        }
+
+        public PropertyType GetPropertyType(string key)
+        {
+            return PropertyExists(key) ? device.GetPropertyType(key) : PropertyType.Invalid;
+        }
+        
+        public void StringListPrepend(string key, string value)
+        {
+            device.SetPropertyString(key, value);
+        }
+        
+        public void StringListAppend(string key, string value)
+        {
+            device.StringListAppend(key, value);
+        }
+        
+        public void StringListRemove(string key, string value)
+        {
+            device.StringListRemove(key, value);
+        }
+        
+        public void SetPropertyString(string key, string value)
+        {
+            device.SetPropertyString(key, value);
+        }
+        
+        public void SetPropertyUInt64(string key, ulong value)
+        {
+            device.SetProperty(key, value);
+        }
+
+        public void SetPropertyInteger(string key, int value)
+        {
+            device.SetPropertyInteger(key, value);
+        }
+
+        public void SetPropertyDouble(string key, double value)
+        {
+            device.SetPropertyDouble(key, value);
+        }
+
+        public void SetPropertyBoolean(string key, bool value)
+        {
+            device.SetPropertyBoolean(key, value);
+        }
+        
+        public void SetPropertyStringList(string key, string [] value)
+        {
+            device.SetPropertyStringList(key, value);
+        }
+        
+        public void RemoveProperty(string key)
+        {
+            device.RemoveProperty(key);
+        }
+        
+        public bool PropertyExists(string key)
+        {
+            return device.PropertyExists(key);
+        }
+        
+        public void AddCapability(string capability)
+        {
+            device.AddCapability(capability);
+        }
+        
+        public bool QueryCapability(string capability)
+        {
+            return device.QueryCapability(capability);
+        }
+        
+        public T CastDevice<T>()
+        {
+            if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) {
+                throw new ApplicationException("Could not find org.freedesktop.Hal");
+            }
+            
+            return Bus.System.GetObject<T>("org.freedesktop.Hal", new ObjectPath(Udi));
+        }
+
+        public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
+        {
+            return device.GetAllProperties().GetEnumerator();
+        }
+        
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return device.GetAllProperties().GetEnumerator();
+        }
+        
+        public bool Equals(Device other)
+        {
+            return Udi.Equals(other.Udi);
+        }
+        
+        public bool Equals(Device a, Device b)
+        {
+            return a.Udi.Equals(b.Udi);
+        }
+        
+        public int CompareTo(Device other)
+        {
+            return Udi.CompareTo(other.Udi);
+        }
+        
+        public int Compare(Device a, Device b)
+        {
+            return a.Udi.CompareTo(b.Udi);
+        }
+        
+        public int GetHashCode(Device a)
+        {
+            return a.Udi.GetHashCode();
+        }
+        
+        public override int GetHashCode()
+        {
+            return Udi.GetHashCode();
+        }
+        
+        public override string ToString()
+        {
+            return udi;
+        }
+        
+        public string this[string property] {
+            get { return PropertyExists(property) ? GetPropertyString(property) : null; }
+            set { SetPropertyString(property, value); }
+        }
+        
+        public string Udi {
+            get { return udi; }
+        }
+        
+        public bool IsVolume {
+            get {
+                if(!PropertyExists("info.interfaces")) {
+                    return false;
+                }
+                
+                foreach(string @interface in GetPropertyStringList("info.interfaces")) {
+                    if(@interface == "org.freedesktop.Hal.Device.Volume") {
+                       return true;
+                    }
+                }
+                
+                return false;
+            }
+        }
+        
+        public Volume Volume {
+            get { return new Volume(Udi); }
+        }
+        
+        public Device Parent {
+            get {
+                if(PropertyExists("info.parent")) {
+                    return new Device(this["info.parent"]);
+                }
+                
+                return null;
+            }
+        }
+    }
+}

Added: trunk/banshee/src/Backends/Banshee.Hal/Hal/Manager.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Hal/Manager.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,198 @@
+//
+// Manager.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-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;
+
+using NDesk.DBus;
+
+namespace Hal
+{
+    internal delegate void DBusDeviceAddedHandler(string udi);
+    internal delegate void DBusDeviceRemovedHandler(string udi);
+    internal delegate void DBusNewCapabilityHandler(string udi, string capability);
+    
+    [Interface("org.freedesktop.Hal.Manager")]
+    internal interface IManager 
+    {
+        event DBusDeviceAddedHandler DeviceAdded;
+        event DBusDeviceRemovedHandler DeviceRemoved;
+        event DBusNewCapabilityHandler NewCapability;
+    
+        string [] GetAllDevices();
+        bool DeviceExists(string udi);
+        string [] FindDeviceStringMatch(string key, string value);
+        string [] FindDeviceByCapability(string capability);
+    }
+    
+    public class DeviceArgs : EventArgs
+    {
+        private string udi;
+        
+        public DeviceArgs(string udi)
+        {
+            this.udi = udi;
+        }
+        
+        public string Udi {
+            get { return udi; }
+        }
+    }
+    
+    public class DeviceAddedArgs : DeviceArgs
+    {
+        private Device device;
+        
+        public DeviceAddedArgs(string udi) : base(udi)
+        {
+        }
+        
+        public Device Device {
+            get { 
+                if(device == null) {
+                    device = new Device(Udi);
+                }
+                
+                return device;
+            }
+        }
+    }
+    
+    public class DeviceRemovedArgs : DeviceArgs
+    {
+        public DeviceRemovedArgs(string udi) : base(udi)
+        {
+        }
+    }
+    
+    public class NewCapabilityArgs : DeviceArgs
+    {
+        private string capability;
+        
+        public NewCapabilityArgs(string udi, string capability) : base(udi)
+        {
+            this.capability = capability;
+        }
+        
+        public string Capability {
+            get { return capability; }
+        }
+    }
+    
+    public delegate void DeviceAddedHandler(object o, DeviceAddedArgs args);
+    public delegate void DeviceRemovedHandler(object o, DeviceRemovedArgs args);
+    public delegate void NewCapabilityHandler(object o, NewCapabilityArgs args);
+    
+    public class Manager : IEnumerable<string>
+    {
+        private IManager manager;
+        
+        public event DeviceAddedHandler DeviceAdded;
+        public event DeviceRemovedHandler DeviceRemoved;
+        public event NewCapabilityHandler NewCapability;
+        
+        public Manager()
+        {
+            if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) {
+                throw new ApplicationException("Could not find org.freedesktop.Hal");
+            }
+            
+            manager = Bus.System.GetObject<IManager>("org.freedesktop.Hal",
+                new ObjectPath("/org/freedesktop/Hal/Manager"));
+            
+            if(manager == null) {
+                throw new ApplicationException("The /org/freedesktop/Hal/Manager object could not be located on the DBUs interface org.freedesktop.Hal");
+            }
+
+            manager.DeviceAdded += OnDeviceAdded;
+            manager.DeviceRemoved += OnDeviceRemoved;
+            manager.NewCapability += OnNewCapability;
+        }
+        
+        protected virtual void OnDeviceAdded(string udi)
+        {
+            if(DeviceAdded != null)
+                DeviceAdded(this, new DeviceAddedArgs(udi));
+        }
+        
+        protected virtual void OnDeviceRemoved(string udi)
+        {
+            if(DeviceRemoved != null)
+                DeviceRemoved(this, new DeviceRemovedArgs(udi));
+        }
+        
+        protected virtual void OnNewCapability(string udi, string capability)
+        {
+            if(NewCapability != null)
+                NewCapability(this, new NewCapabilityArgs(udi, capability));
+        }
+        
+        public bool DeviceExists(string udi)
+        {
+            return manager.DeviceExists(udi);
+        }
+        
+        public string [] FindDeviceByStringMatch(string key, string value)
+        {
+            return manager.FindDeviceStringMatch(key, value);
+        }
+        
+        public string [] FindDeviceByCapability(string capability)
+        {
+            return manager.FindDeviceByCapability(capability);
+        }
+        
+        public Device [] FindDeviceByCapabilityAsDevice(string capability)
+        {
+            return Device.UdisToDevices(FindDeviceByCapability(capability));
+        }
+        
+        public Device [] FindDeviceByStringMatchAsDevice(string key, string value)
+        {
+            return Device.UdisToDevices(FindDeviceByStringMatch(key, value));
+        }
+        
+        public string [] GetAllDevices()
+        {
+            return manager.GetAllDevices();
+        }
+        
+        public IEnumerator<string> GetEnumerator()
+        {
+            foreach(string device in GetAllDevices()) {
+                yield return device;
+            }
+        }
+        
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+    }
+}

Added: trunk/banshee/src/Backends/Banshee.Hal/Hal/Volume.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Hal/Hal/Volume.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,81 @@
+//
+// Volume.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-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;
+
+using NDesk.DBus;
+
+namespace Hal
+{
+    [Interface("org.freedesktop.Hal.Device.Volume")]
+    internal interface IVolume
+    {
+        void Mount(string [] args);
+        void Unmount(string [] args);
+        void Eject(string [] args);
+    }
+    
+    public class Volume : Device
+    {
+        public Volume(string udi) : base(udi)
+        {
+        }
+
+        public void Mount()
+        {
+            Mount(new string [] { String.Empty });
+        }
+        
+        public void Mount(params string [] args)
+        {
+            CastDevice<IVolume>().Mount(args);
+        }
+        
+        public void Unmount()
+        {
+            Unmount(new string [] { String.Empty });
+        }
+        
+        public void Unmount(params string [] args)
+        {
+            CastDevice<IVolume>().Unmount(args);
+        }
+        
+        public void Eject()
+        {
+            Eject(new string [] { String.Empty });
+        }
+        
+        public void Eject(params string [] args)
+        {
+            CastDevice<IVolume>().Eject(args);
+        }
+    }
+}

Modified: trunk/banshee/src/Backends/Makefile.am
==============================================================================
--- trunk/banshee/src/Backends/Makefile.am	(original)
+++ trunk/banshee/src/Backends/Makefile.am	Fri Mar 28 01:46:33 2008
@@ -1,4 +1,5 @@
 SUBDIRS = \
+	Banshee.Hal \
 	Banshee.Gnome \
 	Banshee.GStreamer \
 	Banshee.Unix

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 01:46:33 2008
@@ -27,6 +27,8 @@
 //
 
 using System;
+using System.Collections.Generic;
+
 using Mono.Addins;
 using Hyena;
 
@@ -58,9 +60,47 @@
                 throw new Exception ("No HardwareManager extensions could be loaded. Hardware support will be disabled.");
             }
         }
+        
+        public void Dispose ()
+        {
+            manager.Dispose ();
+        }
+        
+        public IEnumerable<IBlockDevice> GetAllBlockDevices ()
+        {
+            return manager.GetAllBlockDevices ();
+        }
+        
+        public IEnumerable<ICdromDevice> GetAllCdromDevices ()
+        {
+            return manager.GetAllCdromDevices ();
+        }
+        
+        public IEnumerable<IDiskDevice> GetAllDiskDevices ()
+        {
+            return manager.GetAllDiskDevices ();
+        }
+        
+        public void Test ()
+        {
+            Console.WriteLine ("All Block Devices:");
+            foreach (IBlockDevice device in GetAllBlockDevices ()) {
+                Console.WriteLine ("  {0}, {1}", device.GetType ().FullName, device);
+            }
+            
+            Console.WriteLine ("All CD-ROM Devices:");
+            foreach (ICdromDevice device in GetAllCdromDevices ()) {
+                Console.WriteLine ("  {0}, {1}", device.GetType ().FullName, device);
+            }
+            
+            Console.WriteLine ("All Disk Devices:");
+            foreach (IDiskDevice device in GetAllDiskDevices ()) {
+                Console.WriteLine ("  {0}, {1}", device.GetType ().FullName, device);
+            }
+        }
              
         string IService.ServiceName {
             get { return "HardwareManager"; }
-        }   
+        } 
     }
 }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IBlockDevice.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IBlockDevice.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IBlockDevice.cs	Fri Mar 28 01:46:33 2008
@@ -33,7 +33,7 @@
 {
     public interface IBlockDevice : IDevice, IEnumerable<IVolume>
     {
-        int VolumeCount { get; }
+        string DeviceNode { get; }
         IEnumerable<IVolume> Volumes { get; }
     }
 }

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/ICdromDevice.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/ICdromDevice.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,37 @@
+//
+// ICdromDevice.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 System.Collections.Generic;
+
+namespace Banshee.Hardware
+{
+    public interface ICdromDevice : IBlockDevice
+    {
+    }
+}

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDevice.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDevice.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDevice.cs	Fri Mar 28 01:46:33 2008
@@ -33,8 +33,6 @@
     public interface IDevice
     {
         string Uuid { get; }
-        string DeviceNode { get; }
         string Name { get; }
-        IDevice Parent { get; }
     }
 }

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDiscVolume.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDiscVolume.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,40 @@
+//
+// IDiscVolume.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;
+
+namespace Banshee.Hardware
+{
+    public interface IDiscVolume : IVolume
+    {
+        bool HasAudio { get; }
+        bool HasData { get; }
+        bool IsRewritable { get; }
+        bool IsBlank { get; }
+    }
+}

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDiskDevice.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IDiskDevice.cs	Fri Mar 28 01:46:33 2008
@@ -0,0 +1,37 @@
+//
+// IDiskDevice.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 System.Collections.Generic;
+
+namespace Banshee.Hardware
+{
+    public interface IDiskDevice : IBlockDevice
+    {
+    }
+}

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 01:46:33 2008
@@ -27,10 +27,14 @@
 //
 
 using System;
+using System.Collections.Generic;
 
 namespace Banshee.Hardware
 {
-    public interface IHardwareManager
+    public interface IHardwareManager : IDisposable
     {
+        IEnumerable<IBlockDevice> GetAllBlockDevices ();
+        IEnumerable<ICdromDevice> GetAllCdromDevices ();
+        IEnumerable<IDiskDevice> GetAllDiskDevices ();
     }
 }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IVolume.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IVolume.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Hardware/IVolume.cs	Fri Mar 28 01:46:33 2008
@@ -1,5 +1,5 @@
 //
-// IBlockDevice.cs
+// IVolume.cs
 //
 // Author:
 //   Aaron Bockover <abockover novell com>
@@ -34,6 +34,7 @@
     {
         string MountPoint { get; }
         bool IsMounted { get; }
+        bool IsMountedReadOnly { get; }
         ulong Capacity { get; }
         ulong Available { get; }
         new IBlockDevice Parent { get; }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml	Fri Mar 28 01:46:33 2008
@@ -16,4 +16,8 @@
     <ExtensionNode name="PlayerEngine"/>
   </ExtensionPoint>
 
+  <ExtensionPoint path="/Banshee/Platform/HardwareManager">
+    <ExtensionNode name="HardwareManager"/>
+  </ExtensionPoint>
+
 </Addin>

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 01:46:33 2008
@@ -131,13 +131,15 @@
     <File name="Banshee.Library/VideoLibrarySource.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.ServiceStack/Client.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Collection.Database/DatabaseArtistInfo.cs" subtype="Code" buildaction="Compile" />
-    <File name="Banshee.Hardware" subtype="Directory" buildaction="Compile" />
     <File name="Banshee.Hardware/HardwareManager.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Hardware/IDevice.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Hardware/IBlockDevice.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Hardware/IVolume.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Hardware/IHardwareManager.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.ServiceStack/IRequiredService.cs" subtype="Code" buildaction="Compile" />
+    <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" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
@@ -162,4 +164,4 @@
     <AsmRefVar />
     <ProjectRefVar />
   </MonoDevelop.Autotools.MakefileInfo>
-</Project>
+</Project>
\ No newline at end of file

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 01:46:33 2008
@@ -37,7 +37,10 @@
 	Banshee.Equalizer/EqualizerSettingEvent.cs \
 	Banshee.Hardware/HardwareManager.cs \
 	Banshee.Hardware/IBlockDevice.cs \
+	Banshee.Hardware/ICdromDevice.cs \
 	Banshee.Hardware/IDevice.cs \
+	Banshee.Hardware/IDiscVolume.cs \
+	Banshee.Hardware/IDiskDevice.cs \
 	Banshee.Hardware/IHardwareManager.cs \
 	Banshee.Hardware/IVolume.cs \
 	Banshee.Library/HomeDirectoryImportSource.cs \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]