[gnome-shell-extensions/wip/fmuellner/53-hide-network-mounts: 445/445] drive-menu: Don't assume mounts without volume are local




commit 4fc118f2f9a09ba41034d813a3e9ec1b97004a2b
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Feb 5 22:16:09 2018 +0100

    drive-menu: Don't assume mounts without volume are local
    
    The intention of the code is to only expose actually plugged in
    devices rather than network mounts, but the existing heuristics are
    based on GVolume and simply assume a local mount where there's no
    associated volume. Fill that gap by querying the ::remote filesystem
    attribute in that case.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/53

 extensions/drive-menu/extension.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index e516066..b10571c 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -63,9 +63,9 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
         let volume = this.mount.get_volume();
 
         if (!volume) {
-            // probably a GDaemonMount, could be network or
-            // local, but we can't tell; assume it's local for now
-            return true;
+            const attr = Gio.FILE_ATTRIBUTE_FILESYSTEM_REMOTE;
+            const info = this.mount.get_root().query_filesystem_info(attr, null);
+            return !info.get_attribute_boolean(attr);
         }
 
         return volume.get_identifier('class') !== 'network';


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