WorkspacesDisplay: clean up workspacesView lists
Rather than sometimes having a list and sometimes null, keep an array always and check for its length. https://bugzilla.gnome.org/show_bug.cgi?id=688234
This commit is contained in:
parent
5487f8cf93
commit
176daa1469
@ -499,7 +499,8 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
|
this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
|
||||||
controls.add_actor(this._thumbnailsBox.actor);
|
controls.add_actor(this._thumbnailsBox.actor);
|
||||||
|
|
||||||
this._workspacesViews = null;
|
this._workspacesViews = [];
|
||||||
|
this._workspaces = [];
|
||||||
this._primaryScrollAdjustment = null;
|
this._primaryScrollAdjustment = null;
|
||||||
|
|
||||||
this._settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
|
this._settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
|
||||||
@ -643,7 +644,7 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
|
|
||||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||||
this._workspacesViews[i].destroy();
|
this._workspacesViews[i].destroy();
|
||||||
this._workspacesViews = null;
|
this._workspacesViews = [];
|
||||||
|
|
||||||
for (let i = 0; i < this._workspaces.length; i++)
|
for (let i = 0; i < this._workspaces.length; i++)
|
||||||
for (let w = 0; w < this._workspaces[i].length; w++) {
|
for (let w = 0; w < this._workspaces[i].length; w++) {
|
||||||
@ -662,14 +663,12 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_updateWorkspacesViews: function() {
|
_updateWorkspacesViews: function() {
|
||||||
if (this._workspacesViews)
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
this._workspacesViews[i].destroy();
|
||||||
this._workspacesViews[i].destroy();
|
|
||||||
|
|
||||||
if (this._workspaces)
|
for (let i = 0; i < this._workspaces.length; i++)
|
||||||
for (let i = 0; i < this._workspaces.length; i++)
|
for (let w = 0; w < this._workspaces[i].length; w++)
|
||||||
for (let w = 0; w < this._workspaces[i].length; w++)
|
this._workspaces[i][w].destroy();
|
||||||
this._workspaces[i][w].destroy();
|
|
||||||
|
|
||||||
this._workspacesViews = [];
|
this._workspacesViews = [];
|
||||||
this._workspaces = [];
|
this._workspaces = [];
|
||||||
@ -717,7 +716,7 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getPrimaryView: function() {
|
_getPrimaryView: function() {
|
||||||
if (!this._workspacesViews)
|
if (!this._workspacesViews.length)
|
||||||
return null;
|
return null;
|
||||||
if (this._workspacesOnlyOnPrimary)
|
if (this._workspacesOnlyOnPrimary)
|
||||||
return this._workspacesViews[0];
|
return this._workspacesViews[0];
|
||||||
@ -826,7 +825,7 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_updateWorkspacesGeometry: function() {
|
_updateWorkspacesGeometry: function() {
|
||||||
if (!this._workspacesViews)
|
if (!this._workspacesViews.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let fullWidth = this.actor.allocation.x2 - this.actor.allocation.x1;
|
let fullWidth = this.actor.allocation.x2 - this.actor.allocation.x1;
|
||||||
@ -884,7 +883,7 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
this._updateAlwaysZoom();
|
this._updateAlwaysZoom();
|
||||||
this._updateZoom();
|
this._updateZoom();
|
||||||
|
|
||||||
if (this._workspacesViews == null)
|
if (!this._workspacesViews.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let oldNumWorkspaces = this._workspaces[0].length;
|
let oldNumWorkspaces = this._workspaces[0].length;
|
||||||
@ -946,7 +945,7 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
this._zoomOut = shouldZoom;
|
this._zoomOut = shouldZoom;
|
||||||
this._updateWorkspacesGeometry();
|
this._updateWorkspacesGeometry();
|
||||||
|
|
||||||
if (!this._workspacesViews)
|
if (!this._workspacesViews.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Tweener.addTween(this,
|
Tweener.addTween(this,
|
||||||
|
Loading…
Reference in New Issue
Block a user