[geary/wip/713247-tls] Final cleanup, wording
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/713247-tls] Final cleanup, wording
- Date: Thu, 28 Aug 2014 23:29:00 +0000 (UTC)
commit 857f82c6c35374ec5784f2afee6a7c2100c051da
Author: Jim Nelson <jim yorba org>
Date: Thu Aug 28 16:29:07 2014 -0700
Final cleanup, wording
src/client/application/geary-controller.vala | 24 +++--------
src/client/dialogs/certificate-warning-dialog.vala | 47 ++++++++++++++++---
src/engine/api/geary-account-information.vala | 13 +++++
ui/certificate_warning_dialog.glade | 35 ++++++--------
4 files changed, 73 insertions(+), 46 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index ebf1c26..990b548 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -593,13 +593,13 @@ public class GearyController : Geary.BaseObject {
// if these are in validation, there are complex GTK and workflow issues from simply
// presenting the prompt now, so caller who connected will need to do it on their own dime
if (!validating_endpoints.contains(endpoint))
- prompt_for_untrusted_host(main_window, account_information, endpoint, service);
+ prompt_for_untrusted_host(main_window, account_information, endpoint, service, false);
}
private void prompt_for_untrusted_host(Gtk.Window? parent, Geary.AccountInformation account_information,
- Geary.Endpoint endpoint, Geary.Service service) {
- CertificateWarningDialog dialog = new CertificateWarningDialog(parent, endpoint, service,
- endpoint.tls_validation_warnings);
+ Geary.Endpoint endpoint, Geary.Service service, bool is_validation) {
+ CertificateWarningDialog dialog = new CertificateWarningDialog(parent, account_information,
+ service, endpoint.tls_validation_warnings, is_validation);
switch (dialog.run()) {
case CertificateWarningDialog.Result.TRUST:
endpoint.trust_untrusted_host = Geary.Trillian.TRUE;
@@ -672,23 +672,11 @@ public class GearyController : Geary.BaseObject {
else
parent = main_window;
- Geary.Endpoint endpoint;
- switch (service) {
- case Geary.Service.IMAP:
- endpoint = account_information.get_imap_endpoint();
- break;
-
- case Geary.Service.SMTP:
- endpoint = account_information.get_smtp_endpoint();
- break;
-
- default:
- assert_not_reached();
- }
+ Geary.Endpoint endpoint = account_information.get_endpoint_for_service(service);
// If Endpoint had unresolved TLS issues, prompt user about them
if (endpoint.tls_validation_warnings != 0 && endpoint.trust_untrusted_host != Geary.Trillian.TRUE) {
- prompt_for_untrusted_host(parent, account_information, endpoint, service);
+ prompt_for_untrusted_host(parent, account_information, endpoint, service, true);
prompted = true;
}
diff --git a/src/client/dialogs/certificate-warning-dialog.vala
b/src/client/dialogs/certificate-warning-dialog.vala
index b95fc6a..d3d9f01 100644
--- a/src/client/dialogs/certificate-warning-dialog.vala
+++ b/src/client/dialogs/certificate-warning-dialog.vala
@@ -14,25 +14,56 @@ public class CertificateWarningDialog {
private const string BULLET = "• ";
private Gtk.Dialog dialog;
- private Gtk.Label top_label;
- private Gtk.Label warnings_label;
- public CertificateWarningDialog(Gtk.Window? parent, Geary.Endpoint endpoint, Geary.Service service,
- TlsCertificateFlags warnings) {
+ public CertificateWarningDialog(Gtk.Window? parent, Geary.AccountInformation account_information,
+ Geary.Service service, TlsCertificateFlags warnings, bool is_validation) {
Gtk.Builder builder = GearyApplication.instance.create_builder("certificate_warning_dialog.glade");
dialog = (Gtk.Dialog) builder.get_object("CertificateWarningDialog");
- top_label = (Gtk.Label) builder.get_object("top_label");
- warnings_label = (Gtk.Label) builder.get_object("warnings_label");
-
dialog.transient_for = parent;
dialog.modal = true;
- top_label.label = _("The identity of the %s mail server at %s:%u could not be verified:").printf(
+ Gtk.Label title_label = (Gtk.Label) builder.get_object("untrusted_connection_label");
+ Gtk.Label top_label = (Gtk.Label) builder.get_object("top_label");
+ Gtk.Label warnings_label = (Gtk.Label) builder.get_object("warnings_label");
+ Gtk.Label trust_label = (Gtk.Label) builder.get_object("trust_label");
+ Gtk.Label dont_trust_label = (Gtk.Label) builder.get_object("dont_trust_label");
+ Gtk.Label contact_label = (Gtk.Label) builder.get_object("contact_label");
+
+ title_label.label = _("Untrusted Connection: %s").printf(account_information.email);
+
+ Geary.Endpoint endpoint = account_information.get_endpoint_for_service(service);
+ top_label.label = _("The identity of the %s mail server at %s:%u could not be verified.").printf(
service.user_label(), endpoint.remote_address.hostname, endpoint.remote_address.port);
warnings_label.label = generate_warning_list(warnings);
warnings_label.use_markup = true;
+
+ trust_label.label =
+ "<b>"
+ +_("Selecting \"Trust This Server\" or \"Always Trust This Server\" may cause your username and
password to be transmitted insecurely.")
+ + "</b>";
+ trust_label.use_markup = true;
+
+ if (is_validation) {
+ // could be a new or existing account
+ dont_trust_label.label =
+ "<b>"
+ + _("Selecting \"Don't Trust This Server\" will cause Geary not to access this server.")
+ + "</b> "
+ + _("Geary will not add or update this email account.");
+ } else {
+ // a registered account
+ dont_trust_label.label =
+ "<b>"
+ + _("Selecting \"Don't Trust This Server\" will cause Geary to stop accessing this account.")
+ + "</b> "
+ + _("Geary will exit if you have no other open email accounts.");
+ }
+ dont_trust_label.use_markup = true;
+
+ contact_label.label =
+ _("Contact your system administrator or email service provider if you have any question about
these issues.");
}
private static string generate_warning_list(TlsCertificateFlags warnings) {
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 2783df4..926dc27 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -590,6 +590,19 @@ public class Geary.AccountInformation : BaseObject {
untrusted_host(endpoint, security, cx, Service.SMTP);
}
+ public Geary.Endpoint get_endpoint_for_service(Geary.Service service) {
+ switch (service) {
+ case Service.IMAP:
+ return get_imap_endpoint();
+
+ case Service.SMTP:
+ return get_smtp_endpoint();
+
+ default:
+ assert_not_reached();
+ }
+ }
+
private Geary.FolderPath? build_folder_path(Gee.List<string>? parts) {
if (parts == null || parts.size == 0)
return null;
diff --git a/ui/certificate_warning_dialog.glade b/ui/certificate_warning_dialog.glade
index 5e832bf..e6ff2d3 100644
--- a/ui/certificate_warning_dialog.glade
+++ b/ui/certificate_warning_dialog.glade
@@ -99,10 +99,10 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="untrusted_connection_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Untrusted Connection</property>
+ <property name="label">(empty)</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -117,7 +117,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -132,7 +132,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -148,41 +148,39 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="dont_trust_label">
+ <object class="GtkLabel" id="contact_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="valign">end</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Selecting "Don't Trust This Server" will cause
Geary to exit if you have no other registered email accounts.</property>
+ <property name="label">(empty)</property>
<property name="wrap">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="bottom_label">
+ <object class="GtkLabel" id="dont_trust_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="valign">end</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Contact your system administrator or email service
provider if you have any question about these issues.</property>
+ <property name="label">(empty)</property>
+ <property name="use_markup">True</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">3</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -190,17 +188,14 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Selecting "Trust This Server" or "Always Trust
This Server" may cause your email username and password to be transmitted insecurely.</property>
+ <property name="label">(empty)</property>
<property name="wrap">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]