[gnome-shell-extensions/extension-live-disable: 11/11] user-theme: port to new extension API
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/extension-live-disable: 11/11] user-theme: port to new extension API
- Date: Tue, 2 Aug 2011 21:37:59 +0000 (UTC)
commit 1eb245c514e8e31de29d426cafea126947af3fd1
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Aug 2 23:34:30 2011 +0200
user-theme: port to new extension API
main() has been replaced by init(), enable() and disable()
extensions/user-theme/extension.js | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js
index be1416f..38f77da 100644
--- a/extensions/user-theme/extension.js
+++ b/extensions/user-theme/extension.js
@@ -15,11 +15,26 @@ function ThemeManager() {
ThemeManager.prototype = {
_init: function() {
+ },
+
+ enable: function() {
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
- this._settings.connect('changed::'+SETTINGS_KEY, Lang.bind(this, this._changeTheme));
+ this._changedId = this._settings.connect('changed::'+SETTINGS_KEY, Lang.bind(this, this._changeTheme));
this._changeTheme();
},
+ disable: function() {
+ if (this._changedId) {
+ this._settings.disconnect(this._changedId);
+ this._changedId = 0;
+ }
+
+ this._settings = null;
+
+ Main.setThemeStylesheet(null);
+ Main.loadTheme();
+ },
+
_changeTheme: function() {
let _stylesheet = null;
let _themeName = this._settings.get_string(SETTINGS_KEY);
@@ -52,6 +67,6 @@ ThemeManager.prototype = {
}
-function main(metadata) {
- new ThemeManager();
+function init(metadata) {
+ return new ThemeManager();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]