[polari] joinDialog: Open connections page first in case no existing connections
- From: Kunal Jain <kunaljain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] joinDialog: Open connections page first in case no existing connections
- Date: Wed, 24 Feb 2016 21:22:19 +0000 (UTC)
commit 37e3493832382968b5f85def8d24c6ef21bab751
Author: Kunaal Jain <kunaalus gmail com>
Date: Tue Feb 23 07:41:40 2016 +0530
joinDialog: Open connections page first in case no existing connections
When we don't have any connections, the main page is useless
and the user must create a connection first. Therefore it
makes sense to simply start with the right page. Also in that
case use cancel button instead of back button.
https://bugzilla.gnome.org/show_bug.cgi?id=762488
src/joinDialog.js | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 3f98f76..9194786 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -57,8 +57,6 @@ const JoinDialog = new Lang.Class({
this._setupMainPage();
this._setupConnectionPage();
- this._setPage(DialogPage.MAIN);
-
this._accountsMonitor = AccountsMonitor.getDefault();
this._roomManager = ChatroomManager.getDefault();
@@ -94,10 +92,19 @@ const JoinDialog = new Lang.Class({
this._accountsMonitor.disconnect(this._accountRemovedId);
}));
+ if (this._hasAccounts)
+ this._setPage(DialogPage.MAIN);
+ else
+ this._setPage(DialogPage.CONNECTION);
+
this._updateConnectionCombo();
this._updateCanJoin();
},
+ get _hasAccounts() {
+ return Object.keys(this._accounts).length > 0;
+ },
+
_setupMainPage: function() {
this._connectionButton.connect('clicked', Lang.bind(this,
function() {
@@ -252,15 +259,16 @@ const JoinDialog = new Lang.Class({
_setPage: function(page) {
let isMain = page == DialogPage.MAIN;
+ let isAccountsEmpty = !this._hasAccounts;
if (isMain)
this._nameEntry.grab_focus();
else
this._customToggle.active = false;
- this._backButton.visible = !isMain;
this._joinButton.visible = isMain;
- this._cancelButton.visible = isMain;
+ this._cancelButton.visible = isMain || isAccountsEmpty;
+ this._backButton.visible = !(isMain || isAccountsEmpty);
this.title = isMain ? _("Join Chat Room")
: _("Add Network");
this._mainStack.visible_child_name = isMain ? 'main' : 'connection';
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]