Commits

Byron Clark committed 435512e

Mount the CD on DeviceChanged events.

This is not a correct fix, as it also remounts the CD after an unmount is
issued, but it's a starting point.

refs issue 1

  • Participants
  • Parent commits ab8f793

Comments (0)

Files changed (1)

         self.bus.add_signal_receiver(self.device_added,
                                      signal_name='DeviceAdded',
                                      bus_name='org.freedesktop.UDisks')
+        self.bus.add_signal_receiver(self.device_changed,
+                                     signal_name='DeviceChanged',
+                                     bus_name='org.freedesktop.UDisks')
 
     def _mount_device(self, device):
         if device.is_handleable() and not device.is_mounted():
         self.log.debug('device added: %s' % (device,))
         self._mount_device(udiskie.device.Device(self.bus, device))
 
+    def device_changed(self, device):
+        self.log.debug('device changed: %s' % (device,))
+        device = udiskie.device.Device(self.bus, device)
+        if not device.is_mounted():
+            self._mount_device(device)
+
 
 def cli(args):
     parser = optparse.OptionParser()