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))); } }
public IEnumerable <IDevice> GetAllDevices() { foreach (GLib.IVolume vol in monitor.Volumes) { var device = GudevDeviceFromGioVolume(vol); if (device == null) { continue; } volume_device_map [vol.Handle] = device; var raw = CreateRawVolume(vol); if (raw == null) { continue; } yield return(HardwareManager.Resolve(new Device(raw))); } }
private void VolumeChanged(GLib.IVolume volume) { if (volume == null) { Hyena.Log.Error("Gio.Manager: ignoring VolumeChanged signal with no volume"); return; } var handler = DeviceChanged; if (handler != null) { var raw = CreateRawVolume(volume); if (raw == null) { return; } var device = new Device(raw); handler(this, new MountArgs(HardwareManager.Resolve(device))); } }
private void VolumeAdded(GLib.IVolume volume) { var device = GudevDeviceFromGioVolume(volume); if (device == null) { Hyena.Log.ErrorFormat("VolumeAdded: {0}/{1} with no matching udev device", volume.Name, volume.Uuid); return; } volume_device_map [volume.Handle] = device; var h = DeviceAdded; if (h != null) { var raw = CreateRawVolume(volume); if (raw == null) { return; } var dev = new Device(raw); h(this, new MountArgs(HardwareManager.Resolve(dev))); } }
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)))); } }