[polari] joinDialog: Focus the most relevant element on view switches



commit bc06cc69de18f5d93352be7e04035027a4d87326
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Feb 5 13:57:35 2016 +0100

    joinDialog: Focus the most relevant element on view switches
    
    In the main view that's the room name entry, which is the only non-optional
    setting. In the connection view, both server- and username entries are
    required, but we have a reasonable default for the latter, so focusing
    the server entry makes most sense.

 src/connections.js |    6 ++++--
 src/joinDialog.js  |    4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/connections.js b/src/connections.js
index d466c48..24bb212 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -37,8 +37,6 @@ const ConnectionDetails = new Lang.Class({
         this._nickEntry.connect('changed',
                                 Lang.bind(this, this._onCanConfirmChanged));
 
-        this._nickEntry.text = GLib.get_user_name();
-
         let realnameStore = new Gtk.ListStore();
         realnameStore.set_column_types([GObject.TYPE_STRING]);
         realnameStore.insert_with_valuesv(-1, [0], [GLib.get_real_name()]);
@@ -49,6 +47,8 @@ const ConnectionDetails = new Lang.Class({
                                                    popup_completion: false });
         this._realnameEntry.set_completion(completion);
 
+        this.reset();
+
         if (!this._account)
             return;
 
@@ -102,6 +102,8 @@ const ConnectionDetails = new Lang.Class({
         this._descEntry.text = '';
         this._nickEntry.text = GLib.get_user_name();
         this._realnameEntry.text = '';
+
+        this._serverEntry.grab_focus();
     },
 
     _onCanConfirmChanged: function() {
diff --git a/src/joinDialog.js b/src/joinDialog.js
index dbbcdf3..c91eb55 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -92,8 +92,6 @@ const JoinDialog = new Lang.Class({
 
         this._updateConnectionCombo();
         this._updateCanConfirm();
-
-        this._nameEntry.grab_focus();
     },
 
     _setupMainPage: function() {
@@ -228,6 +226,8 @@ const JoinDialog = new Lang.Class({
         let isMain = page == DialogPage.MAIN;
 
         if (isMain)
+            this._nameEntry.grab_focus();
+        else
             this._details.reset();
 
         this._backButton.visible = !isMain;


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