[gnome-shell-extensions] places-menu: can now ask user for info on mounting



commit 0824847ac1e5875e91abd1c796ad6da599030fd2
Author: Christian Kellner <christian kellner me>
Date:   Sat Apr 29 00:56:34 2017 +0200

    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 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index 4f27bb6..fc4b0a9 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]