diff options
-rw-r--r-- | extensions/deviceicon/volume.py | 13 | ||||
-rw-r--r-- | src/jarabe/journal/volumestoolbar.py | 7 | ||||
-rw-r--r-- | src/jarabe/view/palettes.py | 14 |
3 files changed, 19 insertions, 15 deletions
diff --git a/extensions/deviceicon/volume.py b/extensions/deviceicon/volume.py index ec7b2e2..f1f223c 100644 --- a/extensions/deviceicon/volume.py +++ b/extensions/deviceicon/volume.py @@ -34,6 +34,7 @@ from jarabe.frame.frameinvoker import FrameWidgetInvoker _icons = {} +volume_monitor = None class DeviceView(TrayIcon): @@ -100,6 +101,7 @@ def setup(tray): def _setup_volumes(tray): + global volume_monitor volume_monitor = Gio.VolumeMonitor.get() for volume in volume_monitor.get_volumes(): @@ -121,17 +123,20 @@ def _mount(volume, tray): # Follow Nautilus behaviour here # since it has the same issue with removable device # and it would be good to not invent our own workflow - if hasattr(volume, 'should_automount') and not volume.should_automount(): + if not volume.should_automount(): return #TODO: should be done by some other process, like gvfs-hal-volume-monitor - #TODO: use volume.should_automount() when it gets into pygtk if volume.get_mount() is None and volume.can_mount(): #TODO: pass None as mount_operation, or better, SugarMountOperation - volume.mount(Gtk.MountOperation(tray.get_toplevel()), _mount_cb) + flags = 0 + mount_operation = Gtk.MountOperation(parent=tray.get_toplevel()) + cancellable = None + user_data = None + volume.mount(flags, mount_operation, cancellable, _mount_cb, user_data) -def _mount_cb(volume, result): +def _mount_cb(volume, result, user_data): logging.debug('_mount_cb %r %r', volume, result) volume.mount_finish(result) diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py index 8f4692d..1fc368e 100644 --- a/src/jarabe/journal/volumestoolbar.py +++ b/src/jarabe/journal/volumestoolbar.py @@ -251,13 +251,6 @@ class VolumesToolbar(Gtk.Toolbar): if button.props.active: self.emit('volume-changed', button.mount_point) - def _unmount_activated_cb(self, menu_item, mount): - logging.debug('VolumesToolbar._unmount_activated_cb: %r', mount) - mount.unmount(self.__unmount_cb) - - def __unmount_cb(self, source, result): - logging.debug('__unmount_cb %r %r', source, result) - def _get_button_for_mount(self, mount): mount_point = mount.get_root().get_path() for button in self.get_children(): diff --git a/src/jarabe/view/palettes.py b/src/jarabe/view/palettes.py index 35475d0..10844ea 100644 --- a/src/jarabe/view/palettes.py +++ b/src/jarabe/view/palettes.py @@ -246,11 +246,17 @@ class VolumePalette(Palette): self.connect('popup', self.__popup_cb) def __unmount_activate_cb(self, menu_item): - self._mount.unmount(self.__unmount_cb) - - def __unmount_cb(self, mount, result): + flags = 0 + mount_operation = Gtk.MountOperation( \ + parent=self.content_box.get_toplevel()) + cancellable = None + user_data = None + self._mount.unmount_with_operation(flags, mount_operation, cancellable, + self.__unmount_cb, user_data) + + def __unmount_cb(self, mount, result, user_data): logging.debug('__unmount_cb %r %r', mount, result) - mount.unmount_finish(result) + mount.unmount_with_operation_finish(result) def __popup_cb(self, palette): mount_point = self._mount.get_root().get_path() |