[overview] disable the AddWorkspaceButton if there are >= 16 workspaces

https://bugzilla.gnome.org/show_bug.cgi?id=606460
This commit is contained in:
Dan Winship 2010-01-18 14:56:02 -05:00
parent 4deef2a9ef
commit a50d64e8e9

View File

@ -467,6 +467,9 @@ Overview.prototype = {
};
Signals.addSignalMethods(Overview.prototype);
// Note that mutter has a compile-time limit of 36
const MAX_WORKSPACES = 16;
function AddWorkspaceButton(buttonSize, buttonX, buttonY, acceptDropCallback) {
this._init(buttonSize, buttonX, buttonY, acceptDropCallback);
}
@ -487,6 +490,21 @@ AddWorkspaceButton.prototype = {
height: buttonSize });
plus.set_from_file(global.imagedir + 'add-workspace.svg');
this.actor.add_actor(plus);
global.screen.connect('notify::n-workspaces', Lang.bind(this, this._nWorkspacesChanged));
this._nWorkspacesChanged();
},
_nWorkspacesChanged: function() {
let canAddAnother = global.screen.n_workspaces < MAX_WORKSPACES;
if (canAddAnother && !this.actor.reactive) {
this.actor.reactive = true;
this.actor.opacity = 255;
} else if (!canAddAnother && this.actor.reactive) {
this.actor.reactive = false;
this.actor.opacity = 85;
}
},
// Draggable target interface