From 477ec424933d04e0b71f86d31a465b3fdf2e2e4c Mon Sep 17 00:00:00 2001 From: Dan Breslau Date: Wed, 10 Aug 2016 15:32:42 -0400 Subject: [PATCH] Minor updates to trust anchor management --- src/moonshot-id.vala | 11 ++++++----- src/moonshot-idcard-widget.vala | 10 +++++----- src/moonshot-identity-management-view.vala | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/moonshot-id.vala b/src/moonshot-id.vala index 77afd4e..515b73e 100644 --- a/src/moonshot-id.vala +++ b/src/moonshot-id.vala @@ -34,9 +34,10 @@ using Gee; public class TrustAnchor : Object { - public static const string TYPE_CA_CERT = _("CA Certificate"); - public static const string TYPE_ENTERPRISE = _("Enterprise provisioned"); - + public enum TrustAnchorType { + CA_CERT, + SERVER_CERT + } private string _ca_cert = ""; private string _subject = ""; @@ -84,8 +85,8 @@ public class TrustAnchor : Object return ca_cert == "" && subject == "" && subject_alt == "" && server_cert == ""; } - public string get_anchor_type() { - return server_cert == "" ? TYPE_CA_CERT : TYPE_ENTERPRISE; + public TrustAnchorType get_anchor_type() { + return server_cert == "" ? TrustAnchorType.CA_CERT : TrustAnchorType.SERVER_CERT; } public int Compare(TrustAnchor other) diff --git a/src/moonshot-idcard-widget.vala b/src/moonshot-idcard-widget.vala index 6cd2b37..0df4b95 100644 --- a/src/moonshot-idcard-widget.vala +++ b/src/moonshot-idcard-widget.vala @@ -122,20 +122,20 @@ class IdCardWidget : Box update_id_card_label() { // !!TODO: Use a table to format the labels and values - string services_text = "Services: "; - string service_spacer = "\n "; + string services_text = _("Services: "); + string service_spacer = _("\n "); - var label_text = Markup.printf_escaped("%s", this.id_card.display_name); + var label_text = Markup.printf_escaped(_("%s"), this.id_card.display_name); if (is_selected) { label_text += "\nUsername: " + id_card.username; label_text += "\nRealm: " + id_card.issuer; if (!id_card.trust_anchor.is_empty()) { - label_text += "\nTrust anchor: " + id_card.trust_anchor.get_anchor_type(); + label_text += _("\nTrust anchor: Enterprise provisioned"); } services_text += this.id_card.get_services_string(service_spacer); - label_text += "\n" + services_text; + label_text += _("\n") + services_text; } label.set_markup(label_text); diff --git a/src/moonshot-identity-management-view.vala b/src/moonshot-identity-management-view.vala index 54899c1..9d728e9 100644 --- a/src/moonshot-identity-management-view.vala +++ b/src/moonshot-identity-management-view.vala @@ -590,7 +590,7 @@ public class IdentityManagerView : Window { private bool check_and_confirm_trust_anchor(IdCard id) { - if (!id.trust_anchor.is_empty() && id.trust_anchor.get_anchor_type() == TrustAnchor.TYPE_ENTERPRISE) { + if (!id.trust_anchor.is_empty() && id.trust_anchor.get_anchor_type() == TrustAnchor.TrustAnchorType.SERVER_CERT) { if (get_string_setting("TrustAnchors", id.nai) != id.trust_anchor.server_cert) { bool ret = false; -- 2.1.4