[gnome-shell] switcherPopup: Implement functions to add and remove accessible states
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] switcherPopup: Implement functions to add and remove accessible states
- Date: Wed, 26 Feb 2020 22:53:02 +0000 (UTC)
commit bfb0bc7a291af8ba75ab3d8c99bc1616e08db536
Author: Jonas Dreßler <verdre v0yd nl>
Date: Thu Apr 26 11:19:40 2018 +0200
switcherPopup: Implement functions to add and remove accessible states
Set the accessible states of the switcherList items by calling a
function instead of manipulating class-internal variables from outside
the class, which is considered bad practice.
The check whether the item at `_selectedIndex` exists can also be
removed since we always select a new index after an item was removed
(i.e. an app was closed) and destroy the alt-tab switcher right away if
no more items exist (see `SwitcherPopup._itemRemovedHandler`).
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/167
js/ui/altTab.js | 5 ++---
js/ui/switcherPopup.js | 8 ++++++++
2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 0130fa245d..12b7849399 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -365,8 +365,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
},
});
this._thumbnails = null;
- if (this._switcherList._items[this._selectedIndex])
- this._switcherList._items[this._selectedIndex].remove_accessible_state(Atk.StateType.EXPANDED);
+ this._switcherList.removeAccessibleState(this._selectedIndex, Atk.StateType.EXPANDED);
}
_createThumbnails() {
@@ -395,7 +394,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
},
});
- this._switcherList._items[this._selectedIndex].add_accessible_state(Atk.StateType.EXPANDED);
+ this._switcherList.addAccessibleState(this._selectedIndex, Atk.StateType.EXPANDED);
}
});
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index 5f2839cf2c..46a4b158ad 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -444,6 +444,14 @@ var SwitcherList = GObject.registerClass({
this.emit('item-removed', index);
}
+ addAccessibleState(index, state) {
+ this._items[index].add_accessible_state(state);
+ }
+
+ removeAccessibleState(index, state) {
+ this._items[index].remove_accessible_state(state);
+ }
+
_onItemClicked(index) {
this._itemActivated(index);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]