[gnome-shell-extensions] alternate-tab: port to the new keybindings infrastructure



commit f8ee696c7c92268d407981b5cd3c184bcdc7fdab
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Nov 20 16:20:10 2012 +0100

    alternate-tab: port to the new keybindings infrastructure
    
    Keybindings were refactored in 3.7.2, to allow handling them
    while the shell is modal, and now require a set of flags indicating
    the "allowed modes"

 extensions/alternate-tab/extension.js |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/extensions/alternate-tab/extension.js b/extensions/alternate-tab/extension.js
index 9f771ce..52ddd4e 100644
--- a/extensions/alternate-tab/extension.js
+++ b/extensions/alternate-tab/extension.js
@@ -428,16 +428,20 @@ function init(metadata) {
     settings = Convenience.getSettings();
 }
 
+function setKeybinding(name, func) {
+    Main.wm.setCustomKeybindingHandler(name, Main.KeybindingMode.NORMAL, func);
+}
+
 function enable() {
-    Meta.keybindings_set_custom_handler('switch-windows', doAltTab);
-    Meta.keybindings_set_custom_handler('switch-group', doAltTab);
-    Meta.keybindings_set_custom_handler('switch-windows-backward', doAltTab);
-    Meta.keybindings_set_custom_handler('switch-group-backward', doAltTab);
+    setKeybinding('switch-windows', doAltTab);
+    setKeybinding('switch-group', doAltTab);
+    setKeybinding('switch-windows-backward', doAltTab);
+    setKeybinding('switch-group-backward', doAltTab);
 }
 
 function disable() {
-    Meta.keybindings_set_custom_handler('switch-windows', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
-    Meta.keybindings_set_custom_handler('switch-group', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
-    Meta.keybindings_set_custom_handler('switch-windows-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
-    Meta.keybindings_set_custom_handler('switch-group-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
+    setKeybinding('switch-windows', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
+    setKeybinding('switch-group', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
+    setKeybinding('switch-windows-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
+    setKeybinding('switch-group-backward', Lang.bind(Main.wm, Main.wm._startAppSwitcher));
 }



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