[gnome-shell-extensions/extension-live-disable: 7/11] example: 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: 7/11] example: port to new extension API
- Date: Tue, 2 Aug 2011 21:37:39 +0000 (UTC)
commit 67dc01ea36332531e7379b8b1982f8c93ff8ac58
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Aug 2 23:32:35 2011 +0200
example: port to new extension API
main() has been replaced by init(), enable() and disable()
extensions/example/extension.js | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/extensions/example/extension.js b/extensions/example/extension.js
index 6c6a847..68dfa2a 100644
--- a/extensions/example/extension.js
+++ b/extensions/example/extension.js
@@ -16,9 +16,20 @@ function _showHello() {
}
// Put your extension initialization code here
-function main(metadata) {
+function init(metadata) {
imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
+}
+
+let signalId;
+function enable() {
Main.panel.actor.reactive = true;
- Main.panel.actor.connect('button-release-event', _showHello);
+ signalId = Main.panel.actor.connect('button-release-event', _showHello);
}
+
+function disable() {
+ if (signalId) {
+ Main.panel.actor.disconnect(signalId);
+ signalId = 0;
+ }
+}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]