[polari/gnome-3-26] joinDialog: Improve network selection via keyboard



commit 62f06b1de8c9327eac0c61726374f0200b1b8be8
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 2 01:46:08 2017 +0100

    joinDialog: Improve network selection via keyboard
    
    In order to allow for keyboard-friendly network selection, we currently
    activate the first one when the filter entry is activated. While this
    is generally what we want, it's not very obvious that this will happen.
    So instead, keep the first row selected while filtering, and activate
    the selected entry when hitting enter.

 src/connections.js | 14 ++++++++++----
 src/joinDialog.js  |  2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/connections.js b/src/connections.js
index fbec967..846e6c7 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -129,13 +129,19 @@ var ConnectionsList = new Lang.Class({
     },
 
     setFilter: function(filter) {
-        if (Utils.updateTerms(this._filterTerms, filter))
-            this._list.invalidate_filter();
-    },
+        if (!Utils.updateTerms(this._filterTerms, filter))
+            return;
+
+        this._list.invalidate_filter();
 
-    activateFirst: function() {
         let row = this._list.get_row_at_y(0);
         if (row)
+            this._list.select_row(row);
+    },
+
+    activateSelected: function() {
+        let row = this._list.get_selected_row();
+        if (row)
             row.activate();
     },
 
diff --git a/src/joinDialog.js b/src/joinDialog.js
index c04803b..a5b35e1 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -146,7 +146,7 @@ var JoinDialog = new Lang.Class({
         });
         this._filterEntry.connect('activate', () => {
             if (this._filterEntry.text.length > 0)
-                this._connectionsList.activateFirst();
+                this._connectionsList.activateSelected();
         });
     },
 


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