workspacesView: Don't show workspace switcher when it doesn't make sense

Hide workspace switcher if dynamic workspaces is disabled and number of
workspaces is set to one only, since the user is bound to only one workspace
and showing the switcher is redundant.

Signed-off-by: Seif Lotfy <seif@lotfy.com>
This commit is contained in:
Seif Lotfy 2012-10-19 13:55:18 +02:00 committed by Seif Lotfy
parent f6458f215f
commit 78f6dec73b

View File

@ -541,6 +541,16 @@ const WorkspacesDisplay = new Lang.Class({
this._notifyOpacityId = 0; this._notifyOpacityId = 0;
this._swipeScrollBeginId = 0; this._swipeScrollBeginId = 0;
this._swipeScrollEndId = 0; this._swipeScrollEndId = 0;
this._settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
this._settings.connect('changed::dynamic-workspaces',
Lang.bind(this, this._updateSwitcherVisibility));
},
_updateSwitcherVisibility: function() {
this._thumbnailsBox.actor.visible =
this._settings.get_boolean('dynamic-workspaces') ||
global.screen.n_workspaces > 1;
}, },
show: function() { show: function() {
@ -563,6 +573,7 @@ const WorkspacesDisplay = new Lang.Class({
this._controls.show(); this._controls.show();
this._thumbnailsBox.show(); this._thumbnailsBox.show();
this._updateSwitcherVisibility();
this._updateWorkspacesViews(); this._updateWorkspacesViews();
@ -974,6 +985,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].updateWorkspaces(oldNumWorkspaces, this._workspacesViews[i].updateWorkspaces(oldNumWorkspaces,
newNumWorkspaces); newNumWorkspaces);
this._updateSwitcherVisibility();
}, },
_updateZoom : function() { _updateZoom : function() {