[gnome-shell] autorunManager: Don't scan the filesystem if autorun is disabled



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

    autorunManager: Don't scan the filesystem if autorun is disabled
    
    Content-Type scanning can be expensive, and the user disabled autorun, so...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684093

 js/ui/components/autorunManager.js |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index 942576a..495063e 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -83,13 +83,20 @@ const ContentTypeDiscoverer = new Lang.Class({
 
     _init: function(callback) {
         this._callback = callback;
+        this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
     },
 
     guessContentTypes: function(mount) {
-        // guess mount's content types using GIO
-        mount.guess_content_type(false, null,
-                                 Lang.bind(this,
-                                           this._onContentTypeGuessed));
+        let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN);
+
+        if (autorunEnabled) {
+            // guess mount's content types using GIO
+            mount.guess_content_type(false, null,
+                                     Lang.bind(this,
+                                               this._onContentTypeGuessed));
+        } else {
+            this._emitCallback(mount, []);
+        }
     },
 
     _onContentTypeGuessed: function(mount, res) {



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