[gnome-shell] autorunManager: Clean up mount operations
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] autorunManager: Clean up mount operations
- Date: Wed, 3 Oct 2012 17:35:06 +0000 (UTC)
commit 7e496b1979e9891d2d0c987f7ca9818b4e99d5de
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Sep 19 01:38:26 2012 -0300
autorunManager: Clean up mount operations
Add a processMount function that's shared between mount scanning
and hotplug.
https://bugzilla.gnome.org/show_bug.cgi?id=684093
js/ui/components/autorunManager.js | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index 541c75c..942576a 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -175,16 +175,21 @@ const AutorunManager = new Lang.Class({
this._volumeMonitor.disconnect(this._mountRemovedId);
},
+ _processMount: function(mount, hotplug) {
+ let discoverer = new ContentTypeDiscoverer(Lang.bind(this, function(mount, apps, contentTypes) {
+ this._ensureResidentSource();
+ this._residentSource.addMount(mount, apps);
+
+ if (hotplug)
+ this._transDispatcher.addMount(mount, apps, contentTypes);
+ }));
+ discoverer.guessContentTypes(mount);
+ },
+
_scanMounts: function() {
let mounts = this._volumeMonitor.get_mounts();
- mounts.forEach(Lang.bind(this, function (mount) {
- let discoverer = new ContentTypeDiscoverer(Lang.bind (this,
- function (mount, apps) {
- this._ensureResidentSource();
- this._residentSource.addMount(mount, apps);
- }));
-
- discoverer.guessContentTypes(mount);
+ mounts.forEach(Lang.bind(this, function(mount) {
+ this._processMount(mount, false);
}));
},
@@ -194,14 +199,7 @@ const AutorunManager = new Lang.Class({
if (!this._loginManager.sessionActive)
return;
- let discoverer = new ContentTypeDiscoverer(Lang.bind (this,
- function (mount, apps, contentTypes) {
- this._transDispatcher.addMount(mount, apps, contentTypes);
- this._ensureResidentSource();
- this._residentSource.addMount(mount, apps);
- }));
-
- discoverer.guessContentTypes(mount);
+ this._processMount(mount, true);
},
_onMountRemoved: function(monitor, mount) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]