From 0824847ac1e5875e91abd1c796ad6da599030fd2 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Sat, 29 Apr 2017 00:56:34 +0200 Subject: [PATCH] places-menu: can now ask user for info on mounting When we try to launch an application for an uri where the enclosing mount is not yet mounted we might need information from the user such as passwwords. Using a MountOperation makes this possible. https://bugzilla.gnome.org/show_bug.cgi?id=781788 --- extensions/places-menu/placeDisplay.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 4f27bb6b..fc4b0a90 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -12,6 +12,7 @@ const DND = imports.ui.dnd; const Main = imports.ui.main; const Params = imports.misc.params; const Search = imports.ui.search; +const ShellMountOperation = imports.ui.shellMountOperation; const Util = imports.misc.util; const Gettext = imports.gettext.domain('gnome-shell-extensions'); @@ -49,9 +50,17 @@ const PlaceInfo = new Lang.Class({ try { Gio.AppInfo.launch_default_for_uri_finish(result); } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) { - this.file.mount_enclosing_volume(0, null, null, (file, result) => { + let source = { + get_icon: () => { return this.icon; } + }; + let op = new ShellMountOperation.ShellMountOperation(source); + this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => { try { + op.close(); file.mount_enclosing_volume_finish(result); + } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) { + // e.g. user canceled the password dialog + return; } catch(e) { Main.notifyError(_("Failed to mount volume for ā€œ%sā€").format(this.name), e.message); return;