[gnome-shell] autorunManager: Don't try to scan remote filesystems



commit 0ad739e78b9342e91af9e0947808ce2627215232
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Sep 16 14:54:25 2012 -0300

    autorunManager: Don't try to scan remote filesystems
    
    Content-Type scanning can be super expensive. The autorun manager is meant
    for local filesystems that are plugged into a USB port or similar, not
    remote NFS or sshfs mounts.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684093

 js/ui/components/autorunManager.js |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index 495063e..5490df5 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -44,6 +44,19 @@ function isMountRootHidden(root) {
     return (path.indexOf('/.') != -1);
 }
 
+function isMountNonLocal(mount) {
+    // If the mount doesn't have an associated volume, that means it could
+    // be a remote filesystem. For certain kinds of local filesystems,
+    // like digital cameras and music players, there's no associated
+    // gvfs volume, so err on the side of caution and assume it's a local
+    // filesystem to allow the prompt.
+    let volume = mount.get_volume();
+    if (volume == null)
+        return false;
+
+    return (volume.get_identifier("class") == "network");
+}
+
 function startAppForMount(app, mount) {
     let files = [];
     let root = mount.get_root();
@@ -88,8 +101,9 @@ const ContentTypeDiscoverer = new Lang.Class({
 
     guessContentTypes: function(mount) {
         let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN);
+        let shouldScan = autorunEnabled && !isMountNonLocal(mount);
 
-        if (autorunEnabled) {
+        if (shouldScan) {
             // guess mount's content types using GIO
             mount.guess_content_type(false, null,
                                      Lang.bind(this,



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