[gnome-shell/hotplug: 3/21] autorun: don't add non-autorunnable volumes to the remove list
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/hotplug: 3/21] autorun: don't add non-autorunnable volumes to the remove list
- Date: Mon, 27 Jun 2011 19:52:12 +0000 (UTC)
commit b3b4522882e4a5f10ae9144f2a36109ca12c074b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Jun 20 17:48:28 2011 -0400
autorun: don't add non-autorunnable volumes to the remove list
Basically we want to filter out non-devices there, like network mounts,
archives, or blank media.
js/ui/autorunManager.js | 42 +++++++++++++++++++++++++-----------------
1 files changed, 25 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/autorunManager.js b/js/ui/autorunManager.js
index 4bad96b..2fbe344 100644
--- a/js/ui/autorunManager.js
+++ b/js/ui/autorunManager.js
@@ -13,6 +13,27 @@ const SETTING_DISABLE_AUTORUN = 'autorun-never';
const HOTPLUG_ICON_SIZE = 16;
+// misc utils
+function ignoreAutorunForMount(mount) {
+ let root = mount.get_root();
+ let volume = mount.get_volume();
+
+ if ((root.is_native() && !isMountRootHidden(root)) ||
+ (volume && volume.should_automount()))
+ return false;
+
+ return true;
+}
+
+function isMountRootHidden(root) {
+ let path = root.get_path();
+
+ // skip any mounts in hidden directory hierarchies
+ return (path.indexOf('/.') != -1);
+}
+
+/******************************************/
+
function ContentTypeDiscoverer(callback) {
this._init(callback);
}
@@ -156,6 +177,9 @@ AutorunResidentSource.prototype = {
},
addMount: function(mount, contentTypes) {
+ if (ignoreAutorunForMount(mount))
+ return;
+
let filtered = this._mounts.filter(function (element) {
return (element.mount == mount);
});
@@ -315,22 +339,6 @@ AutorunTransientDispatcher.prototype = {
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
},
- _ignoreAutorunForMount: function(mount) {
- let root = mount.get_root();
- let volume = mount.get_volume();
-
- if ((root.is_native() && !this._mountRootIsHidden(root)) ||
- (volume && volume.should_automount()))
- return false;
-
- return true;
- },
-
- _mountRootIsHidden: function(root) {
- let path = root.get_path();
-
- // skip any mounts in hidden directory hierarchies
- return (path.indexOf('/.') != -1);
},
_getSourceForMount: function(mount) {
@@ -354,7 +362,7 @@ AutorunTransientDispatcher.prototype = {
return;
// if the mount doesn't want to be autorun, return
- if (this._ignoreAutorunForMount(mount))
+ if (ignoreAutorunForMount(mount))
return;
// finally, if we already have a source showing for this
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]