[gnome-shell-extensions/extension-live-disable: 6/8] auto-move-windows: 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: 6/8] auto-move-windows: port to new extension API
- Date: Thu, 18 Aug 2011 14:23:13 +0000 (UTC)
commit 5f299e109be85e66da4904f6fd61aa6e2abaa3ec
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Thu Aug 18 16:17:53 2011 +0200
auto-move-windows: port to new extension API
main() has been replaced by init(), enable() and disable()
I'm not sure it actually disables, it should unless you have more
extensions messing with the same methods.
extensions/auto-move-windows/extension.js | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js
index eb3d70c..fe5d7f9 100644
--- a/extensions/auto-move-windows/extension.js
+++ b/extensions/auto-move-windows/extension.js
@@ -25,7 +25,14 @@ WindowMover.prototype = {
let display = global.screen.get_display();
// Connect after so the handler from ShellWindowTracker has already run
- display.connect_after('window-created', Lang.bind(this, this._findAndMove));
+ this._windowCreatedId = display.connect_after('window-created', Lang.bind(this, this._findAndMove));
+ },
+
+ destroy: function() {
+ if (this._windowCreatedId) {
+ global.screen.get_display().disconnect(this._windowCreatedId);
+ this._windowCreatedId = 0;
+ }
},
_ensureAtLeastWorkspaces: function(num, window) {
@@ -69,7 +76,15 @@ WindowMover.prototype = {
}
}
-function main(extensionMeta) {
+let prevCheckWorkspaces;
+let winMover;
+
+function init(extensionMeta) {
+ // do nothing here
+}
+
+function enable() {
+ prevCheckWorkspaces = Main._checkWorkspaces;
Main._checkWorkspaces = function() {
let i;
let emptyWorkspaces = new Array(Main._workspaces.length);
@@ -138,5 +153,10 @@ function main(extensionMeta) {
};
- new WindowMover();
+ winMover = new WindowMover();
}
+
+function disable() {
+ Main._checkWorkspaces = prevCheckWorkspaces;
+ winMover.destroy();
+}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]