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 {
}
_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())
this.mount.eject_with_operation(Gio.MountUnmountFlags.NONE,
mountOp.mountOp,
null, // Gio.Cancellable
this.mount.eject_with_operation(...unmountArgs,
this._ejectFinish.bind(this));
else
this.mount.unmount_with_operation(Gio.MountUnmountFlags.NONE,
mountOp.mountOp,
null, // Gio.Cancellable
this.mount.unmount_with_operation(...unmountArgs,
this._unmountFinish.bind(this));
}
......
......@@ -183,17 +183,17 @@ class PlaceDeviceInfo extends PlaceInfo {
}
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())
this._mount.eject_with_operation(Gio.MountUnmountFlags.NONE,
mountOp.mountOp,
null, // Gio.Cancellable
this._mount.eject_with_operation(...unmountArgs,
this._ejectFinish.bind(this));
else
this._mount.unmount_with_operation(Gio.MountUnmountFlags.NONE,
mountOp.mountOp,
null, // Gio.Cancellable
this._mount.unmount_with_operation(...unmountArgs,
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