[gnome-shell] extensionSystem: Load/unload stylesheets on enable/disable
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] extensionSystem: Load/unload stylesheets on enable/disable
- Date: Tue, 12 Jun 2012 21:16:58 +0000 (UTC)
commit 11278a0814a92e23629c3fe44b438c0135b705e0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jun 4 18:42:42 2012 -0400
extensionSystem: Load/unload stylesheets on enable/disable
I'm not entirely sure why this wasn't caught earlier.
https://bugzilla.gnome.org/show_bug.cgi?id=677586
js/ui/extensionSystem.js | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 6dde466..cb205a7 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -67,6 +67,11 @@ function disableExtension(uuid) {
}
}
+ if (extension.stylesheet) {
+ let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
+ theme.unload_stylesheet(extension.stylesheet.get_path());
+ }
+
try {
extension.stateObj.disable();
} catch(e) {
@@ -109,6 +114,17 @@ function enableExtension(uuid) {
return;
}
+ let stylesheetFile = extension.dir.get_child('stylesheet.css');
+ if (stylesheetFile.query_exists(null)) {
+ let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
+ try {
+ theme.load_stylesheet(stylesheetFile.get_path());
+ extension.stylesheet = stylesheetFile;
+ } catch (e) {
+ logExtensionError(uuid, 'Stylesheet parse error: ' + e);
+ }
+ }
+
extension.state = ExtensionState.ENABLED;
_signals.emit('extension-state-changed', extension);
}
@@ -163,18 +179,6 @@ function initExtension(uuid) {
logExtensionError(uuid, 'Missing extension.js');
return;
}
- let stylesheetPath = null;
- let themeContext = St.ThemeContext.get_for_stage(global.stage);
- let theme = themeContext.get_theme();
- let stylesheetFile = dir.get_child('stylesheet.css');
- if (stylesheetFile.query_exists(null)) {
- try {
- theme.load_stylesheet(stylesheetFile.get_path());
- } catch (e) {
- logExtensionError(uuid, 'Stylesheet parse error: ' + e);
- return;
- }
- }
let extensionModule;
let extensionState = null;
@@ -182,8 +186,6 @@ function initExtension(uuid) {
ExtensionUtils.installImporter(extension);
extensionModule = extension.imports.extension;
} catch (e) {
- if (stylesheetPath != null)
- theme.unload_stylesheet(stylesheetPath);
logExtensionError(uuid, '' + e);
return;
}
@@ -196,8 +198,6 @@ function initExtension(uuid) {
try {
extensionState = extensionModule.init(extension);
} catch (e) {
- if (stylesheetPath != null)
- theme.unload_stylesheet(stylesheetPath);
logExtensionError(uuid, 'Failed to evaluate init function:' + e);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]