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
This commit is contained in:
Jasper St. Pierre 2012-09-16 14:24:25 -03:00
parent 7e496b1979
commit ff9509b901

View File

@ -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) {