Minor updates to trust anchor management
authorDan Breslau <dbreslau@painless-security.com>
Wed, 10 Aug 2016 19:32:42 +0000 (15:32 -0400)
committerDan Breslau <dbreslau@painless-security.com>
Wed, 10 Aug 2016 19:32:42 +0000 (15:32 -0400)
src/moonshot-id.vala
src/moonshot-idcard-widget.vala
src/moonshot-identity-management-view.vala

index 77afd4e..515b73e 100644 (file)
@@ -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)
index 6cd2b37..0df4b95 100644 (file)
@@ -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("<big>%s</big>", this.id_card.display_name);
+        var label_text = Markup.printf_escaped(_("<big>%s</big>"), 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);
index 54899c1..9d728e9 100644 (file)
@@ -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;