Skip to content

Commit

Permalink
Implement a method for free resources. Intended to be called from dis…
Browse files Browse the repository at this point in the history
…able().
  • Loading branch information
Antonio Hernández committed Oct 26, 2011
1 parent 8e2f5b4 commit cc21cec
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions gnome-shell-windowslist@emergya.com/extension.js
Expand Up @@ -181,7 +181,7 @@ AppMenuButtonAlt.prototype = {

_refreshMenuItems: function() {

// Be sure to upate the box pointer direction
// Be sure to update the box pointer direction
this.setMenuSide();
this.menu.removeAll();
let windows = this.getWindows();
Expand Down Expand Up @@ -328,13 +328,24 @@ WindowsList.prototype = {
global.window_manager.connect('switch-workspace',
Lang.bind(this, this._activeWorkspaceChanged));

Main.panel.actor.connect('allocate', Lang.bind(this, function(container, box, flags) {
this._mainPanelAllocateId = Main.panel.actor.connect('allocate', Lang.bind(this, function(container, box, flags) {
this._allocatePanel(container, box, flags, Main.panel);
}));

this._activeWorkspaceChanged();
},

free: function() {
if (this._windowAddedId)
this.metaWorkspace.disconnect(this._windowAddedId);
if (this._windowRemovedId)
this.metaWorkspace.disconnect(this._windowRemovedId);
global.screen.disconnect(this._nWorkspacesNotifyId);
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
Main.panel.actor.disconnect(this._mainPanelAllocateId);
this._clearWindowsList();
},

/**
* Number of workspaces changed
*/
Expand Down Expand Up @@ -384,7 +395,7 @@ WindowsList.prototype = {

_sync: function() {

this.clearWindowsList();
this._clearWindowsList();

let apps = this.appSystem.get_running();
for (let i = 0, l = apps.length; i < l; i++) {
Expand All @@ -398,7 +409,7 @@ WindowsList.prototype = {
window._apps = this.apps;
},

clearWindowsList: function() {
_clearWindowsList: function() {
let children = this.listContainer.get_children();
for (let i=0, l=children.length; i<l; i++) {
this.listContainer.remove_actor(children[i]);
Expand Down Expand Up @@ -515,7 +526,7 @@ function enable() {
}

function disable() {
wl.clearWindowsList();
wl.free();
wl = null;
Main.panel._leftBox.add_actor(appMenu.actor);
}

0 comments on commit cc21cec

Please sign in to comment.