Commit 1f1f9664 authored by Florian Müllner's avatar Florian Müllner

cleanup: Share unmount/eject arugments

Besides the callback, eject and unmount share the same arguments.
Make this explicit by sharing the common arguments between branches.

!60
parent fb039c0f
...@@ -65,17 +65,17 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { ...@@ -65,17 +65,17 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
} }
_eject() { _eject() {
let mountOp = new ShellMountOperation.ShellMountOperation(this.mount); let unmountArgs = [
Gio.MountUnmountFlags.NONE,
(new ShellMountOperation.ShellMountOperation(this.mount)).mountOp,
null // Gio.Cancellable
];
if (this.mount.can_eject()) if (this.mount.can_eject())
this.mount.eject_with_operation(Gio.MountUnmountFlags.NONE, this.mount.eject_with_operation(...unmountArgs,
mountOp.mountOp,
null, // Gio.Cancellable
this._ejectFinish.bind(this)); this._ejectFinish.bind(this));
else else
this.mount.unmount_with_operation(Gio.MountUnmountFlags.NONE, this.mount.unmount_with_operation(...unmountArgs,
mountOp.mountOp,
null, // Gio.Cancellable
this._unmountFinish.bind(this)); this._unmountFinish.bind(this));
} }
......
...@@ -183,17 +183,17 @@ class PlaceDeviceInfo extends PlaceInfo { ...@@ -183,17 +183,17 @@ class PlaceDeviceInfo extends PlaceInfo {
} }
eject() { eject() {
let mountOp = new ShellMountOperation.ShellMountOperation(this._mount); let unmountArgs = [
Gio.MountUnmountFlags.NONE,
(new ShellMountOperation.ShellMountOperation(this._mount)).mountOp,
null // Gio.Cancellable
];
if (this._mount.can_eject()) if (this._mount.can_eject())
this._mount.eject_with_operation(Gio.MountUnmountFlags.NONE, this._mount.eject_with_operation(...unmountArgs,
mountOp.mountOp,
null, // Gio.Cancellable
this._ejectFinish.bind(this)); this._ejectFinish.bind(this));
else else
this._mount.unmount_with_operation(Gio.MountUnmountFlags.NONE, this._mount.unmount_with_operation(...unmountArgs,
mountOp.mountOp,
null, // Gio.Cancellable
this._unmountFinish.bind(this)); this._unmountFinish.bind(this));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment