5 // Alex Launi <alex.launi@gmail.com>
7 // Copyright (c) 2010 Alex Launi
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 #if ENABLE_GIO_HARDWARE
28 using System
.Collections
.Generic
;
30 using Banshee
.Hardware
;
32 namespace Banshee
.Hardware
.Gio
34 class RawBlockDevice
: RawDevice
36 public RawBlockDevice (GLib
.IDrive drive
, Manager manager
, GioDriveMetadataSource gioMetadata
, UdevMetadataSource udevMetadata
)
37 : base (manager
, gioMetadata
, udevMetadata
)
42 GLib
.IDrive Drive { get; set; }
44 public IEnumerable
<Volume
> Volumes
{
46 foreach (var notVolume
in Drive
.Volumes
) {
47 var volume
= GLib
.VolumeAdapter
.GetObject (notVolume
as GLib
.Object
);
52 var device
= Manager
.GudevDeviceFromGioVolume (volume
);
57 yield return new Volume (new RawVolume (volume
,
59 new GioVolumeMetadataSource (volume
),
60 new UdevMetadataSource (device
)));
65 #region implemented abstract members of Banshee.Hardware.Gio.RawDevice
66 public override string Identifier
{
72 public override string IdMediaPlayer
{
74 return UdevMetadata
.IdMediaDevice
;
78 public override bool IsRemovable
{
80 return Drive
.CanEject ();
84 public override string Name
{
90 public override string Model
{
92 return UdevMetadata
.Model
;
96 public override string Product
{
98 return "Product not implemented";
102 public override string Serial
{
104 return UdevMetadata
.Serial
;
108 public override string Subsystem
{
110 return UdevMetadata
.Subsystem
;
114 public override string Uuid
{
116 return UdevMetadata
.Uuid
;
120 public override string Vendor
{
122 return UdevMetadata
.Vendor
;
126 public override string GetPropertyString (string key
)
128 return UdevMetadata
.GetPropertyString (key
);
131 public override double GetPropertyDouble (string key
)
133 return UdevMetadata
.GetPropertyDouble (key
);
136 public override bool GetPropertyBoolean (string key
)
138 return UdevMetadata
.GetPropertyBoolean (key
);
141 public override int GetPropertyInteger (string key
)
143 return UdevMetadata
.GetPropertyInteger (key
);
146 public override ulong GetPropertyUInt64 (string key
)
148 return UdevMetadata
.GetPropertyUInt64 (key
);
151 public override string[] GetPropertyStringList (string key
)
153 return UdevMetadata
.GetPropertyStringList (key
);
156 public override bool PropertyExists (string key
)
158 return UdevMetadata
.PropertyExists (key
);