[gnome-shell-extensions/wip/jimmac/duller-classic-mode: 8/19] window-list: Refactor workspace signal handlers
- From: Jakub Steiner <jimmac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/wip/jimmac/duller-classic-mode: 8/19] window-list: Refactor workspace signal handlers
- Date: Wed, 3 Jul 2019 13:02:18 +0000 (UTC)
commit 5a4739bdf1b079c629e44c3973bf04aaaf58a620
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Jun 5 05:08:31 2019 +0200
window-list: Refactor workspace signal handlers
We are about to support a separate representation if horizontal
workspaces are used. To prepare for that, rename the handlers to
something more generic and split out menu-specific bits into a
dedicated help function.
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/70
extensions/window-list/workspaceIndicator.js | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js
index 598c516..78ca97e 100644
--- a/extensions/window-list/workspaceIndicator.js
+++ b/extensions/window-list/workspaceIndicator.js
@@ -40,9 +40,9 @@ var WorkspaceIndicator = GObject.registerClass({
this._workspaceManagerSignals = [
workspaceManager.connect('notify::n-workspaces',
- this._updateMenu.bind(this)),
+ this._nWorkspacesChanged.bind(this)),
workspaceManager.connect_after('workspace-switched',
- this._updateIndicator.bind(this))
+ this._onWorkspaceSwitched.bind(this))
];
this.connect('scroll-event', this._onScrollEvent.bind(this));
@@ -65,14 +65,27 @@ var WorkspaceIndicator = GObject.registerClass({
super._onDestroy();
}
- _updateIndicator() {
- this._workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.NONE);
- this._currentWorkspace = global.workspace_manager.get_active_workspace_index();
- this._workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.DOT);
+ _onWorkspaceSwitched() {
+ let workspaceManager = global.workspace_manager;
+ this._currentWorkspace = workspaceManager.get_active_workspace_index();
+
+ this._updateMenuOrnament();
this._statusLabel.set_text(this._getStatusText());
}
+ _nWorkspacesChanged() {
+ this._updateMenu();
+ }
+
+ _updateMenuOrnament() {
+ for (let i = 0; i < this._workspacesItems.length; i++) {
+ this._workspacesItems[i].setOrnament(i == this._currentWorkspace
+ ? PopupMenu.Ornament.DOT
+ : PopupMenu.Ornament.NONE);
+ }
+ }
+
_getStatusText() {
let workspaceManager = global.workspace_manager;
let current = workspaceManager.get_active_workspace_index();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]