[gnome-shell] lookingGlass: add Ctrl+PageUp/PageDown key shortcuts for switching tabs



commit ff01ed5e4b298cede93f4372fb0c244b273d6b54
Author: Jason Siefken <siefkenj gmail com>
Date:   Thu Oct 20 22:23:08 2011 -0700

    lookingGlass: add Ctrl+PageUp/PageDown key shortcuts for switching tabs
    
    The view selector in the overview does it too, so why not here?
    
    https://bugzilla.gnome.org/show_bug.cgi?id=652223

 js/ui/lookingGlass.js |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 6ac5247..0f0dfe9 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -151,6 +151,24 @@ Notebook.prototype = {
             return;
         let vAdjust = tabData.scrollView.vscroll.adjustment;
         vAdjust.value = vAdjust.upper - vAdjust.page_size;
+    },
+
+    nextTab: function() {
+        let nextIndex = this._selectedIndex;
+        if (nextIndex < this._tabs.length - 1) {
+            ++nextIndex;
+        }
+
+        this.selectIndex(nextIndex);
+    },
+
+    prevTab: function() {
+        let prevIndex = this._selectedIndex;
+        if (prevIndex > 0) {
+            --prevIndex;
+        }
+
+        this.selectIndex(prevIndex);
     }
 };
 Signals.addSignalMethods(Notebook.prototype);
@@ -995,6 +1013,7 @@ LookingGlass.prototype = {
     // Handle key events which are relevant for all tabs of the LookingGlass
     _globalKeyPressEvent : function(actor, event) {
         let symbol = event.get_key_symbol();
+        let modifierState = Shell.get_event_state(event);
         if (symbol == Clutter.Escape) {
             if (this._objInspector.actor.visible) {
                 this._objInspector.close();
@@ -1003,6 +1022,14 @@ LookingGlass.prototype = {
             }
             return true;
         }
+        // Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view
+        if (modifierState & Clutter.ModifierType.CONTROL_MASK) {
+            if (symbol == Clutter.KEY_Page_Up) {
+                this._notebook.prevTab();
+            } else if (symbol == Clutter.KEY_Page_Down) {
+                this._notebook.nextTab();
+            }
+        }
         return false;
     },
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]