[polari/wip/fmuellner/design-review: 14/15] joinDialog: Open connections page first in case no existing connections
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/design-review: 14/15] joinDialog: Open connections page first in case no existing connections
- Date: Tue, 23 Feb 2016 17:35:23 +0000 (UTC)
commit f2a322341f560af993589a480a618725a5b0f191
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 | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 3f98f76..9be5dea 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();
@@ -69,6 +67,12 @@ const JoinDialog = new Lang.Class({
return;
this._accounts[a.display_name] = a;
}));
+
+ if (Object.keys(this._accounts).length > 0)
+ this._setPage(DialogPage.MAIN);
+ else
+ this._setPage(DialogPage.CONNECTION);
+
this._accountAddedId =
this._accountsMonitor.connect('account-added', Lang.bind(this,
function(am, account) {
@@ -252,15 +256,16 @@ const JoinDialog = new Lang.Class({
_setPage: function(page) {
let isMain = page == DialogPage.MAIN;
+ let isAccountsEmpty = Object.keys(this._accounts).length == 0;
if (isMain)
this._nameEntry.grab_focus();
else
this._customToggle.active = false;
- this._backButton.visible = !isMain;
+ this._backButton.visible = !isMain && !isAccountsEmpty;
this._joinButton.visible = isMain;
- this._cancelButton.visible = isMain;
+ this._cancelButton.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]