Thomas Gläßle avatar Thomas Gläßle committed 90c1eb7

Use proxy for issueing device method calls

Comments (0)

Files changed (1)

udiskie/device.py

         self.log = logging.getLogger('udiskie.device.Device')
         self.bus = bus
         self.device_path = device_path
-        self.device = self.bus.get_object(UDISKS_OBJECT, device_path)
-        self.property = DbusProperties(self.device, UDISKS_DEVICE_INTERFACE)
+        device_object = self.bus.get_object(UDISKS_OBJECT, device_path)
+        self.property = DbusProperties(device_object, UDISKS_DEVICE_INTERFACE)
+        self.method = dbus.Interface(device_object, UDISKS_DEVICE_INTERFACE)
 
     def __str__(self):
         return self.device_path
         return self.property.IdUuid
 
     def mount(self, filesystem, options):
-        self.device.FilesystemMount(filesystem, options,
-                                    dbus_interface=UDISKS_DEVICE_INTERFACE)
+        self.method.FilesystemMount(filesystem, options)
 
     def unmount(self):
-        self.device.FilesystemUnmount([], dbus_interface=UDISKS_DEVICE_INTERFACE)
+        self.method.FilesystemUnmount([])
 
     def lock(self, options):
         """Lock Luks device."""
-        return self.device.LuksLock(options,
-                                    dbus_interface=UDISKS_DEVICE_INTERFACE)
+        return self.method.LuksLock(options)
 
     def unlock(self, password, options):
         """Unlock Luks device."""
-        return self.device.LuksUnlock(password, options,
-                               dbus_interface=UDISKS_DEVICE_INTERFACE)
+        return self.method.LuksUnlock(password, options)
 
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.