Cleaning up compilation warnings
[moonshot-ui.git] / src / moonshot-trust-anchor-dialog.vala
index 9fc2213..20def57 100644 (file)
@@ -35,8 +35,6 @@ class TrustAnchorDialog : Dialog
 {
     private static Gdk.Color white = make_color(65535, 65535, 65535);
 
-    private Entry trust_anchor_entry;
-
     public bool complete = false;
 
     public TrustAnchorDialog(IdCard idcard, Window parent)
@@ -46,7 +44,7 @@ class TrustAnchorDialog : Dialog
         this.set_transient_for(parent);
         this.modify_bg(StateType.NORMAL, white);
 
-        this.add_buttons(_("Connect"), ResponseType.OK,
+        this.add_buttons(_("Confirm"), ResponseType.OK,
                          _("Cancel"), ResponseType.CANCEL);
 
         this.set_default_response(ResponseType.OK);
@@ -70,36 +68,17 @@ class TrustAnchorDialog : Dialog
         var realm_label = new Label(_("Realm: ") + idcard.issuer);
         realm_label.set_alignment(0, 0.5f);
 
-        var fingerprint_label = new Label(_("SHA-256 fingerprint:"));
-        fingerprint_label.set_alignment(0, 0.5f);
-
-        var footprint = new TextView();
-        //footprint.activates_default = false;
-        // footprint.set_sensitive(false);
-        footprint.set_editable(false);
-        // footprint.set_text(idcard.trust_anchor.server_cert);
-        var buffer = footprint.get_buffer();
-        buffer.set_text(colonize(idcard.trust_anchor.server_cert), -1);
-        footprint.wrap_mode = WrapMode.WORD_CHAR;
-
-        set_atk_relation(fingerprint_label, footprint, Atk.RelationType.LABEL_FOR);
-
-        var footprint_width_constraint = new ScrolledWindow(null, null);
-        footprint_width_constraint.set_policy(PolicyType.NEVER, PolicyType.NEVER);
-        footprint_width_constraint.set_shadow_type(ShadowType.IN);
-        footprint_width_constraint.set_size_request(400, 60);
-        footprint_width_constraint.add_with_viewport(footprint);
-
         Label confirm_label = new Label(_("Please confirm that this is the correct trust anchor."));
         confirm_label.set_alignment(0, 0.5f);
 
+        var trust_anchor_display = make_ta_fingerprint_widget(idcard.trust_anchor);
+
         var vbox = new VBox(false, 0);
         vbox.set_border_width(6);
         vbox.pack_start(dialog_label, true, true, 12);
         vbox.pack_start(user_label, true, true, 2);
         vbox.pack_start(realm_label, true, true, 2);
-        vbox.pack_start(fingerprint_label, true, true, 2);
-        vbox.pack_start(footprint_width_constraint, true, true, 2);
+        vbox.pack_start(trust_anchor_display, true, true, 0);
         vbox.pack_start(confirm_label, true, true, 12);
 
         ((Container) content_area).add(vbox);
@@ -123,20 +102,4 @@ class TrustAnchorDialog : Dialog
             break;
         }
     }
-
-    // Yeah, it doesn't mean "colonize" the way you might think... :-)
-    private static string colonize(string input) {
-        return_if_fail(input.length % 2 == 0);
-
-        string result = "";
-        int i = 0;
-        while (i < input.length) {
-            if (i > 0) {
-                result += ":";
-            }
-            result += input[i : i + 2];
-            i += 2;
-        }
-        return result;
-    }
 }