[polari/wip/fmuellner/connection-list: 22/22] connections: Hide server settings for predefined networks
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/connection-list: 22/22] connections: Hide server settings for predefined networks
- Date: Tue, 16 Feb 2016 13:29:12 +0000 (UTC)
commit 78e8e20f49d81a5f4038058cfbc554d286ffcff5
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Feb 4 06:45:48 2016 +0100
connections: Hide server settings for predefined networks
The whole point of providing a list of networks is so users needn't
bother with server addresses and ports. In addition, exposing those
settings blurs the line between predefined and custom connections,
which is problematic for features like using encrypted connections
where possible.
So just hide server settings for accounts created from a predefined
network - in the end, users who are unhappy with the picks we make
can still use a custom connection.
https://bugzilla.gnome.org/show_bug.cgi?id=761859
data/resources/connection-details.ui | 20 ++++++++++++++------
src/connections.js | 21 ++++++++++++++++++++-
2 files changed, 34 insertions(+), 7 deletions(-)
---
diff --git a/data/resources/connection-details.ui b/data/resources/connection-details.ui
index d31ef2e..dbc0233 100644
--- a/data/resources/connection-details.ui
+++ b/data/resources/connection-details.ui
@@ -6,7 +6,9 @@
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel" id="name_label">
- <property name="visible">True</property>
+ <property name="visible" bind-source="Gjs_ConnectionDetails"
+ bind-property="has-service"
+ bind-flags="invert-boolean|sync-create"/>
<property name="halign">end</property>
<property name="label" translatable="yes">_Name</property>
<property name="use-underline">True</property>
@@ -15,7 +17,9 @@
</child>
<child>
<object class="GtkEntry" id="nameEntry">
- <property name="visible">True</property>
+ <property name="visible" bind-source="Gjs_ConnectionDetails"
+ bind-property="has-service"
+ bind-flags="invert-boolean|sync-create"/>
<property name="hexpand">True</property>
<property name="activates-default">True</property>
<property name="placeholder-text" translatable="yes">optional</property>
@@ -23,8 +27,11 @@
</child>
<child>
<object class="GtkLabel" id="server_label">
- <property name="visible">True</property>
+ <property name="visible" bind-source="Gjs_ConnectionDetails"
+ bind-property="has-service"
+ bind-flags="invert-boolean|sync-create"/>
<property name="halign">end</property>
+ <property name="margin-bottom">24</property>
<property name="label" translatable="yes">_Server</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">serverEntry</property>
@@ -36,8 +43,11 @@
</child>
<child>
<object class="GtkEntry" id="serverEntry">
- <property name="visible">True</property>
+ <property name="visible" bind-source="Gjs_ConnectionDetails"
+ bind-property="has-service"
+ bind-flags="invert-boolean|sync-create"/>
<property name="hexpand">True</property>
+ <property name="margin-bottom">24</property>
<property name="activates-default">True</property>
</object>
<packing>
@@ -49,7 +59,6 @@
<object class="GtkLabel" id="nickname_label">
<property name="visible">True</property>
<property name="halign">end</property>
- <property name="margin-top">24</property>
<property name="label" translatable="yes">_Nickname</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">nickEntry</property>
@@ -64,7 +73,6 @@
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="can-default">True</property>
- <property name="margin-top">24</property>
<property name="activates-default">True</property>
</object>
<packing>
diff --git a/src/connections.js b/src/connections.js
index 90fdac6..5e3411f 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -179,10 +179,21 @@ const ConnectionDetails = new Lang.Class({
'can-confirm',
'can-confirm',
GObject.ParamFlags.READABLE,
+ false),
+ 'has-serivce': GObject.ParamSpec.boolean('has-service',
+ 'has-service',
+ 'has-service',
+ GObject.ParamFlags.READABLE,
false)},
Signals: { 'account-created': { param_types: [Tp.Account.$gtype] }},
_init: function(params) {
+ this._networksManager = NetworksManager.getDefault();
+ this._networksManager.connect('changed', Lang.bind(this,
+ function() {
+ this.notify('has-service');
+ }));
+
this.parent(params);
this._nameEntry.connect('changed',
@@ -251,7 +262,10 @@ const ConnectionDetails = new Lang.Class({
this._nickEntry.text = this._savedNick;
this._realnameEntry.text = this._savedRealname;
- this._serverEntry.grab_focus();
+ if (this._serverEntry.visible)
+ this._serverEntry.grab_focus();
+ else
+ this._nickEntry.grab_focus();
},
_onCanConfirmChanged: function() {
@@ -291,8 +305,13 @@ const ConnectionDetails = new Lang.Class({
paramsChanged;
},
+ get has_service() {
+ return this._networksManager.getAccountIsPredefined(this._account);
+ },
+
set account(account) {
this._account = account;
+ this.notify('has-service');
this.reset();
if (this._account)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]