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.
This commit is contained in:
Giovanni Campagna
2011-08-18 16:17:53 +02:00
parent 5d26fc2e71
commit 5f299e109b

View File

@@ -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();
}