workspacesView: Simplify extraWorkspaces handling

https://bugzilla.gnome.org/show_bug.cgi?id=686002
This commit is contained in:
Jasper St. Pierre 2012-03-30 14:31:25 -04:00
parent 78f6dec73b
commit a0e0cc1038

View File

@ -72,6 +72,7 @@ const WorkspacesView = new Lang.Class({
this._workspaces[w].actor.reparent(this.actor); this._workspaces[w].actor.reparent(this.actor);
this._workspaces[activeWorkspaceIndex].actor.raise_top(); this._workspaces[activeWorkspaceIndex].actor.raise_top();
this._extraWorkspaces = [];
this._updateExtraWorkspaces(); this._updateExtraWorkspaces();
// Position/scale the desktop windows and their children after the // Position/scale the desktop windows and their children after the
@ -83,8 +84,6 @@ const WorkspacesView = new Lang.Class({
Lang.bind(this, function() { Lang.bind(this, function() {
for (let w = 0; w < this._workspaces.length; w++) for (let w = 0; w < this._workspaces.length; w++)
this._workspaces[w].zoomToOverview(); this._workspaces[w].zoomToOverview();
if (!this._extraWorkspaces)
return;
for (let w = 0; w < this._extraWorkspaces.length; w++) for (let w = 0; w < this._extraWorkspaces.length; w++)
this._extraWorkspaces[w].zoomToOverview(); this._extraWorkspaces[w].zoomToOverview();
})); }));
@ -124,7 +123,6 @@ const WorkspacesView = new Lang.Class({
if (!this._settings.get_boolean('workspaces-only-on-primary')) if (!this._settings.get_boolean('workspaces-only-on-primary'))
return; return;
this._extraWorkspaces = [];
let monitors = Main.layoutManager.monitors; let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) { for (let i = 0; i < monitors.length; i++) {
if (i == Main.layoutManager.primaryIndex) if (i == Main.layoutManager.primaryIndex)
@ -139,12 +137,9 @@ const WorkspacesView = new Lang.Class({
}, },
_destroyExtraWorkspaces: function() { _destroyExtraWorkspaces: function() {
if (!this._extraWorkspaces)
return;
for (let m = 0; m < this._extraWorkspaces.length; m++) for (let m = 0; m < this._extraWorkspaces.length; m++)
this._extraWorkspaces[m].destroy(); this._extraWorkspaces[m].destroy();
this._extraWorkspaces = null; this._extraWorkspaces = [];
}, },
setGeometry: function(x, y, width, height, spacing) { setGeometry: function(x, y, width, height, spacing) {
@ -191,8 +186,6 @@ const WorkspacesView = new Lang.Class({
for (let w = 0; w < this._workspaces.length; w++) for (let w = 0; w < this._workspaces.length; w++)
this._workspaces[w].zoomFromOverview(); this._workspaces[w].zoomFromOverview();
if (!this._extraWorkspaces)
return;
for (let w = 0; w < this._extraWorkspaces.length; w++) for (let w = 0; w < this._extraWorkspaces.length; w++)
this._extraWorkspaces[w].zoomFromOverview(); this._extraWorkspaces[w].zoomFromOverview();
}, },
@ -204,8 +197,6 @@ const WorkspacesView = new Lang.Class({
syncStacking: function(stackIndices) { syncStacking: function(stackIndices) {
for (let i = 0; i < this._workspaces.length; i++) for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].syncStacking(stackIndices); this._workspaces[i].syncStacking(stackIndices);
if (!this._extraWorkspaces)
return;
for (let i = 0; i < this._extraWorkspaces.length; i++) for (let i = 0; i < this._extraWorkspaces.length; i++)
this._extraWorkspaces[i].syncStacking(stackIndices); this._extraWorkspaces[i].syncStacking(stackIndices);
}, },
@ -376,9 +367,6 @@ const WorkspacesView = new Lang.Class({
this._firstDragMotion = false; this._firstDragMotion = false;
for (let i = 0; i < this._workspaces.length; i++) for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].setReservedSlot(dragEvent.dragActor._delegate); this._workspaces[i].setReservedSlot(dragEvent.dragActor._delegate);
if (!this._extraWorkspaces)
return DND.DragMotionResult.CONTINUE;
for (let i = 0; i < this._extraWorkspaces.length; i++) for (let i = 0; i < this._extraWorkspaces.length; i++)
this._extraWorkspaces[i].setReservedSlot(dragEvent.dragActor._delegate); this._extraWorkspaces[i].setReservedSlot(dragEvent.dragActor._delegate);
} }
@ -392,9 +380,6 @@ const WorkspacesView = new Lang.Class({
for (let i = 0; i < this._workspaces.length; i++) for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].setReservedSlot(null); this._workspaces[i].setReservedSlot(null);
if (!this._extraWorkspaces)
return;
for (let i = 0; i < this._extraWorkspaces.length; i++) for (let i = 0; i < this._extraWorkspaces.length; i++)
this._extraWorkspaces[i].setReservedSlot(null); this._extraWorkspaces[i].setReservedSlot(null);
}, },