[polari] ui: Do not try to select disabled accounts in dialogs



commit a4ee6b04e279698cbd415347bd1ff117c9a26abe
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Sep 10 17:41:11 2014 +0200

    ui: Do not try to select disabled accounts in dialogs
    
    Since commit b92901fa003b we will always select the last used
    account in the connections combo box. However this fails miserably
    when the corresponding account does not appear in the combo box
    because it has been disabled, so fall back to picking the first
    entry again in this case ...

 src/joinDialog.js    |    4 +++-
 src/messageDialog.js |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 4f39bbd..e6b9b2e 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -183,7 +183,9 @@ const JoinDialog = new Lang.Class({
 
         let factory = Tp.AccountManager.dup().get_factory();
         let lastUsed = factory.ensure_account(this._settings.get_string('last-used-account'), []);
-        let activeIndex = lastUsed ? names.indexOf(lastUsed.display_name) : 0;
+        let activeIndex = 0;
+        if (lastUsed)
+            activeIndex = Math.max(names.indexOf(lastUsed.display_name), 0);
         this._connectionCombo.set_active(activeIndex);
     },
 
diff --git a/src/messageDialog.js b/src/messageDialog.js
index bf8c2a9..f3a14a3 100644
--- a/src/messageDialog.js
+++ b/src/messageDialog.js
@@ -36,7 +36,9 @@ const MessageDialog = new Lang.Class({
 
         let factory = Tp.AccountManager.dup().get_factory();
         let lastUsed = factory.ensure_account(this._settings.get_string('last-used-account'), []);
-        let activeIndex = lastUsed ? names.indexOf(lastUsed.display_name) : 0;
+        let activeIndex = 0;
+        if (lastUsed)
+            activeIndex = Math.max(names.indexOf(lastUsed.display_name), 0);
         this._connectionCombo.set_active(activeIndex);
 
         this._updateCanConfirm();


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