Esempio n. 1
0
        public IEnumerable <IDevice> GetAllDevices()
        {
            foreach (GLib.Volume vol in monitor.Volumes)
            {
                var device = GudevDeviceFromGioVolume(vol);
                if (device == null)
                {
                    continue;
                }

                volume_device_map [vol.Handle] = device;
                var raw = new RawVolume(vol,
                                        this,
                                        new GioVolumeMetadataSource(vol),
                                        new UdevMetadataSource(device));
                yield return(HardwareManager.Resolve(new Device(raw)));
            }
        }
Esempio n. 2
0
        void VolumeRemoved(GLib.Volume volume)
        {
            var h = DeviceRemoved;

            if (h != null)
            {
                GUdev.Device device;
                if (!volume_device_map.TryGetValue(volume.Handle, out device))
                {
                    Hyena.Log.Debug(string.Format("Tried to unmount {0}/{1} with no matching udev device", volume.Name, volume.Uuid));
                    return;
                }
                var v = new RawVolume(volume,
                                      this,
                                      new GioVolumeMetadataSource(volume),
                                      new UdevMetadataSource(device));

                h(this, new MountArgs(new Device(v)));
            }
        }
Esempio n. 3
0
        void HandleMonitorMountAdded(object o, MountAddedArgs args)
        {
            // Manually get the mount as gio-sharp translates it to the wrong managed object
            var mount = GLib.MountAdapter.GetObject((GLib.Object)args.Args [0]);

            if (mount.Volume == null)
            {
                return;
            }

            var device = GudevDeviceFromGioMount(mount);

            volume_device_map [mount.Volume.Handle] = device;
            var h = DeviceAdded;

            if (h != null)
            {
                var v = new RawVolume(mount.Volume,
                                      this,
                                      new GioVolumeMetadataSource(mount.Volume),
                                      new UdevMetadataSource(device));
                h(this, new MountArgs(HardwareManager.Resolve(new Device(v))));
            }
        }
Esempio n. 4
0
 public Volume(RawDevice device)
     : base(device)
 {
     volume = (RawVolume)device;
 }
 public Volume (RawDevice device)
     : base (device)
 {
     volume = (RawVolume) device;
 }
Esempio n. 6
0
 public UsbVolume(RawVolume volume)
     : base(volume)
 {
 }