From 95693d25d08d6c85b86fac21ee37657afd96e20c Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 27 Dec 2012 17:47:33 +0100 Subject: Use connect/disconnect to add/remove ourself to the panel to disconnect from signals --- extension.js | 17 +++++++++++++---- 1 file 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(); } -- cgit v1.2.3