[gnome-shell-extensions/gnome-3-2] workspace-indicator: fix removing the last workspace
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/gnome-3-2] workspace-indicator: fix removing the last workspace
- Date: Wed, 7 Dec 2011 14:07:41 +0000 (UTC)
commit 6f4e615999afed93d502315570d73a8ea2060469
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Nov 28 19:35:38 2011 +0100
workspace-indicator: fix removing the last workspace
When closing the last workspace, we could access an invalid
item, causing a TypeError and therefore leaving a stale "Workspace 2"
label.
extensions/workspace-indicator/extension.js | 32 +++++++++++++++-----------
1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js
index 7f5ca46..3236eca 100644
--- a/extensions/workspace-indicator/extension.js
+++ b/extensions/workspace-indicator/extension.js
@@ -55,22 +55,26 @@ WorkspaceIndicator.prototype = {
},
_createWorkspacesSection : function() {
- this._workspaceSection.removeAll();
- this.workspacesItems = [];
+ this._workspaceSection.removeAll();
+ this.workspacesItems = [];
+ this._currentWorkspace = global.screen.get_active_workspace().index();
- let i = 0;
- for(; i < global.screen.n_workspaces; i++) {
- this.workspacesItems[i] = new PopupMenu.PopupMenuItem(this._labelText(i));
- this._workspaceSection.addMenuItem(this.workspacesItems[i]);
- this.workspacesItems[i].workspaceId = i;
- this.workspacesItems[i].label_actor = this.statusLabel;
- let self = this;
- this.workspacesItems[i].connect('activate', Lang.bind(this, function(actor, event) {
- this._activate(actor.workspaceId);
- }));
- }
+ let i = 0;
+ for(; i < global.screen.n_workspaces; i++) {
+ this.workspacesItems[i] = new PopupMenu.PopupMenuItem(this._labelText(i));
+ this._workspaceSection.addMenuItem(this.workspacesItems[i]);
+ this.workspacesItems[i].workspaceId = i;
+ this.workspacesItems[i].label_actor = this.statusLabel;
+ let self = this;
+ this.workspacesItems[i].connect('activate', Lang.bind(this, function(actor, event) {
+ this._activate(actor.workspaceId);
+ }));
+
+ if (i == this._currentWorkspace)
+ this.workspacesItems[i].setShowDot(true);
+ }
- this._updateIndicator();
+ this.statusLabel.set_text(this._labelText());
},
_activate : function (index) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]