[gnome-shell/overview-relayout: 9/20] view-selector: Add keyboard shortcut for view switching
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/overview-relayout: 9/20] view-selector: Add keyboard shortcut for view switching
- Date: Mon, 15 Nov 2010 22:39:23 +0000 (UTC)
commit 2fd05c311941327a9810c5253f47c4e5cc72e9f1
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Oct 4 16:05:32 2010 +0200
view-selector: Add keyboard shortcut for view switching
As the view selector is a tabbed interface, use the default keyboard
shortcut of Ctrl-PageUp/PageDown of GtkNotebook for switching between
views.
https://bugzilla.gnome.org/show_bug.cgi?id=634948
js/ui/viewSelector.js | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 74fc368..afc86f4 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -694,6 +694,29 @@ ViewSelector.prototype = {
this._switchTab(this._tabs[0]);
},
+ _nextTab: function() {
+ if (this._tabs.length == 0 ||
+ this._tabs[this._tabs.length - 1] == this._activeTab)
+ return;
+
+ for (let i = 0; i < this._tabs.length; i++)
+ if (this._tabs[i] == this._activeTab) {
+ this._switchTab(this._tabs[i + 1]);
+ return;
+ }
+ },
+
+ _prevTab: function() {
+ if (this._tabs.length == 0 || this._tabs[0] == this._activeTab)
+ return;
+
+ for (let i = 0; i < this._tabs.length; i++)
+ if (this._tabs[i] == this._activeTab) {
+ this._switchTab(this._tabs[i - 1]);
+ return;
+ }
+ },
+
_getPreferredWidth: function(box, forHeight, alloc) {
let children = box.get_children();
for (let i = 0; i < children.length; i++) {
@@ -754,6 +777,7 @@ ViewSelector.prototype = {
if (focus != stage && focus != this._searchEntry.entry)
return false;
+ let modifiers = Shell.get_event_state(event);
let symbol = event.get_key_symbol();
if (symbol == Clutter.Escape) {
Main.overview.hide();
@@ -770,6 +794,16 @@ ViewSelector.prototype = {
this.searchResults.selectDown(false);
return true;
+ } else if (modifiers & Clutter.ModifierType.CONTROL_MASK) {
+ if (symbol == Clutter.Page_Up) {
+ if (!this._searchActive)
+ this._prevTab();
+ return true;
+ } else if (symbol == Clutter.Page_Down) {
+ if (!this._searchActive)
+ this._nextTab();
+ return true;
+ }
}
return false;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]