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

View File

@ -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,