diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-12-27 17:47:33 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-12-27 17:47:33 +0100 |
commit | 95693d25d08d6c85b86fac21ee37657afd96e20c (patch) | |
tree | 5586be5a07501c1f867426e051c2ce7ab1a6e675 | |
parent | 8b2fb765f9f6b5086f0021b89fe0fcdde6306432 (diff) |
Use connect/disconnect
to add/remove ourself to the panel to disconnect from signals
-rw-r--r-- | extension.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/extension.js b/extension.js index 7d3d813..55ddfdf 100644 --- a/extension.js +++ b/extension.js @@ -50,6 +50,17 @@ OnScreenKeyboardButton.prototype = { Main.keyboard.show(); } }, + + connect: function() { + let _children = Main.panel._centerBox.get_children(); + Main.panel._centerBox.insert_child_at_index(this.actor, _children.length - 1); + Main.panel._centerBox.add(this.actor); + }, + + disconnect: function() { + Main.layoutManager.connect(this._keyboardVisibleId); + Main.panel._centerBox.remove_actor(_button.actor); + }, }; let _button; @@ -59,11 +70,9 @@ function init() { } function enable() { - let _children = Main.panel._centerBox.get_children(); - Main.panel._centerBox.insert_child_at_index(_button.actor, _children.length - 1); - Main.panel._centerBox.add(_button.actor); + _button.connect() } function disable() { - Main.panel._centerBox.remove_actor(_button.actor); + _button.disconnect(); } |