[gnome-shell] autorun: simplify code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] autorun: simplify code
- Date: Wed, 20 Jun 2012 14:15:55 +0000 (UTC)
commit ebee01b3550d102d722aaba760d1482fe9bcb8ee
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Jun 19 15:17:07 2012 -0400
autorun: simplify code
Split autorun conditions into separate logic blocks instead of a single
huge if.
https://bugzilla.gnome.org/show_bug.cgi?id=660595
js/ui/autorunManager.js | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/autorunManager.js b/js/ui/autorunManager.js
index 9d39690..7283e16 100644
--- a/js/ui/autorunManager.js
+++ b/js/ui/autorunManager.js
@@ -23,12 +23,14 @@ const AutorunSetting = {
};
// misc utils
-function ignoreAutorunForMount(mount) {
+function shouldAutorunMount(mount) {
let root = mount.get_root();
let volume = mount.get_volume();
- if ((root.is_native() && !isMountRootHidden(root)) &&
- (volume && volume.allowAutorun && volume.should_automount()))
+ if (!volume || !volume.should_automount() || !volume.allowAutorun)
+ return false;
+
+ if (!root.is_native() || isMountRootHidden(root))
return false;
return true;
@@ -270,7 +272,7 @@ const AutorunResidentSource = new Lang.Class({
},
addMount: function(mount, apps) {
- if (ignoreAutorunForMount(mount))
+ if (!shouldAutorunMount(mount))
return;
let filtered = this._mounts.filter(function (element) {
@@ -448,7 +450,7 @@ const AutorunTransientDispatcher = new Lang.Class({
return;
// if the mount doesn't want to be autorun, return
- if (ignoreAutorunForMount(mount))
+ if (!shouldAutorunMount(mount))
return;
let setting = this._getAutorunSettingForType(contentTypes[0]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]