[polari] connections: Make it easier to toggle accounts by keynav



commit e5d9a9ff1adadc90dbee91a98e0c4285ec485eed
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 26 11:32:20 2013 +0200

    connections: Make it easier to toggle accounts by keynav
    
    Instead of requiring to navigate inside the selected row, allow
    to toggle the switch by hitting enter/space.

 src/connections.js |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/connections.js b/src/connections.js
index 79456d4..cc7f243 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -1,3 +1,4 @@
+const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
@@ -96,6 +97,16 @@ const ConnectionsDialog = new Lang.Class({
                         a.set_enabled_finish(res);
                     }));
             });
+
+        row.connect('key-press-event', Lang.bind(this,
+            function(w, ev) {
+                let [, keyval] = ev.get_keyval();
+                if (keyval == Gdk.KEY_space ||
+                    keyval == Gdk.KEY_Return ||
+                    keyval == Gdk.KEY_ISO_Enter ||
+                    keyval == Gdk.KEY_KP_Enter)
+                    sw.activate();
+            }));
     },
 
     _removeAccount: function(account) {


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