From 0c6c453a185fcb9b88d97a7ff4c4f1ae022fa5f8 Mon Sep 17 00:00:00 2001 From: Dan Breslau Date: Tue, 25 Oct 2016 20:19:12 -0400 Subject: [PATCH] Added a confirmation dialog for clearing a Trust Anchor. Also made "Remember my choice for this service" the default. Also fixed some localization issues. --- src/moonshot-identity-dialog.vala | 45 ++++++++++++++++++++---------- src/moonshot-identity-management-view.vala | 2 +- src/moonshot-trust-anchor-dialog.vala | 3 +- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/moonshot-identity-dialog.vala b/src/moonshot-identity-dialog.vala index 3ac1f63..68183ef 100644 --- a/src/moonshot-identity-dialog.vala +++ b/src/moonshot-identity-dialog.vala @@ -242,20 +242,33 @@ class IdentityDialog : Dialog var ta_clear_button = new Button.with_label(_("Clear Trust Anchor")); ta_clear_button.clicked.connect((w) => { - clear_trust_anchor = true; - - // Clearing the trust_anchor_box's children, and then re-packing - // a label into it, doesn't seem to work. Instead, let's clear out - // the table's children, and then re-insert a label into it. - var children = ta_table.get_children(); - foreach (var child in children) { - ta_table.remove(child); - } + var result = WarningDialog.confirm(this, + Markup.printf_escaped( + "" + + _("You are about to clear the trust anchor fingerprint for '%s'.") + + "", + id.display_name) + + _("\n\nAre you sure you want to do this?"), + "clear_trust_anchor"); - ta_table.resize(1, ncolumns); - ta_label.set_text(ta_label_prefix + none); - ta_table.attach(ta_label, 0, 1, 0, 1, - fill_and_expand, fill_and_expand, 0, 0); + if (result) + { + clear_trust_anchor = true; + + // Clearing the trust_anchor_box's children, and then re-packing + // a label into it, doesn't seem to work. Instead, let's clear out + // the table's children, and then re-insert a label into it. + var children = ta_table.get_children(); + foreach (var child in children) { + ta_table.remove(child); + } + + ta_table.resize(1, ncolumns); + ta_label.set_text(ta_label_prefix + none); + ta_table.attach(ta_label, 0, 1, 0, 1, + fill_and_expand, fill_and_expand, 0, 0); + + } } ); @@ -478,9 +491,11 @@ class IdentityDialog : Dialog { var result = WarningDialog.confirm(this, Markup.printf_escaped( - "You are about to remove the service '%s'.", + "" + + _("You are about to remove the service\n'%s'.") + + "", selected_item.label) - + "\n\nAre you sure you want to do this?", + + _("\n\nAre you sure you want to do this?"), "delete_service"); if (result) diff --git a/src/moonshot-identity-management-view.vala b/src/moonshot-identity-management-view.vala index 1c1390f..371f5d7 100644 --- a/src/moonshot-identity-management-view.vala +++ b/src/moonshot-identity-management-view.vala @@ -787,7 +787,7 @@ SUCH DAMAGE. // Right below id_scrollwin: remember_identity_binding = new CheckButton.with_label(_("Remember my identity choice for this service")); - remember_identity_binding.active = false; + remember_identity_binding.active = true; top_table.attach(remember_identity_binding, 0, num_cols / 2, num_rows - 1, num_rows, fill_and_expand, fill_and_expand, 3, 0); var add_button = new Button.with_label(_("Add")); diff --git a/src/moonshot-trust-anchor-dialog.vala b/src/moonshot-trust-anchor-dialog.vala index ac0124c..ee205a9 100644 --- a/src/moonshot-trust-anchor-dialog.vala +++ b/src/moonshot-trust-anchor-dialog.vala @@ -158,7 +158,8 @@ class TrustAnchorDialog : Dialog string label_markup; if (card.trust_anchor.server_cert == "") { - label_markup = "" + _("You are using this identity for the first time with the following trust anchor:") + ""; + label_markup = "" + + _("You are using this identity for the first time with the following trust anchor:") + ""; } else { // The server's fingerprint isn't what we're expecting this server to provide. -- 2.1.4