[gnome-shell] extensionSystem: fix runtime enable()/disable() after last changes
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] extensionSystem: fix runtime enable()/disable() after last changes
- Date: Wed, 8 Feb 2012 22:31:00 +0000 (UTC)
commit d0cd6ba47d08b4cdf412831cfaf139dc11841fea
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Wed Feb 8 18:48:05 2012 +0100
extensionSystem: fix runtime enable()/disable() after last changes
disableExtension still used the old way to retrieve the state object,
and enableExtension called loadExtension at a time that would
always fail.
https://bugzilla.gnome.org/show_bug.cgi?id=669694
js/ui/extensionSystem.js | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 8e0294f..328e929 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -163,8 +163,6 @@ function disableExtension(uuid) {
if (extension.state != ExtensionState.ENABLED)
return;
- let extensionState = extensionStateObjs[uuid];
-
// "Rebase" the extension order by disabling and then enabling extensions
// in order to help prevent conflicts.
@@ -180,14 +178,14 @@ function disableExtension(uuid) {
for (let i = 0; i < orderReversed.length; i++) {
let uuid = orderReversed[i];
try {
- extensionStateObjs[uuid].disable();
+ ExtensionUtils.extensions[uuid].stateObj.disable();
} catch(e) {
logExtensionError(uuid, e.toString());
}
}
try {
- extensionState.disable();
+ extension.stateObj.disable();
} catch(e) {
logExtensionError(uuid, e.toString());
return;
@@ -196,7 +194,7 @@ function disableExtension(uuid) {
for (let i = 0; i < order.length; i++) {
let uuid = order[i];
try {
- extensionStateObjs[uuid].enable();
+ ExtensionUtils.extensions[uuid].stateObj.enable();
} catch(e) {
logExtensionError(uuid, e.toString());
}
@@ -213,10 +211,8 @@ function enableExtension(uuid) {
if (!extension)
return;
- if (extension.state == ExtensionState.INITIALIZED) {
- loadExtension(extension.dir, extension.type, true);
- return;
- }
+ if (extension.state == ExtensionState.INITIALIZED)
+ initExtension(uuid);
if (extension.state != ExtensionState.DISABLED)
return;
@@ -274,11 +270,25 @@ function loadExtension(dir, type, enabled) {
return;
}
- if (!enabled) {
+ if (enabled) {
+ initExtension(uuid);
+ if (extension.state == ExtensionState.DISABLED)
+ enableExtension(uuid);
+ } else {
extension.state = ExtensionState.INITIALIZED;
- return;
}
+ _signals.emit('extension-state-changed', extension);
+ global.log('Loaded extension ' + uuid);
+}
+
+function initExtension(uuid) {
+ let extension = ExtensionUtils.extensions[uuid];
+ let dir = extension.dir;
+
+ if (!extension)
+ throw new Error("Extension was not properly created. Call loadExtension first");
+
let extensionJs = dir.get_child('extension.js');
if (!extensionJs.query_exists(null)) {
logExtensionError(uuid, 'Missing extension.js');
@@ -338,11 +348,7 @@ function loadExtension(dir, type, enabled) {
extension.state = ExtensionState.DISABLED;
- enableExtension(uuid);
-
_signals.emit('extension-loaded', uuid);
- _signals.emit('extension-state-changed', extension);
- global.log('Loaded extension ' + uuid);
}
function onEnabledExtensionsChanged() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]