X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fmoonshot-trust-anchor-dialog.vala;h=0537494dedd8bfa76aab1f99309db7a786664ff7;hb=2f8d4369433a277012679bf877633e686820eab8;hp=b3de3df8eb27042c57ed0395fd32b07e87ec82a1;hpb=cd3606be187f0c69b7cc657c66460d79837e5f57;p=moonshot-ui.git
diff --git a/src/moonshot-trust-anchor-dialog.vala b/src/moonshot-trust-anchor-dialog.vala
index b3de3df..0537494 100644
--- a/src/moonshot-trust-anchor-dialog.vala
+++ b/src/moonshot-trust-anchor-dialog.vala
@@ -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,8 +44,8 @@ class TrustAnchorDialog : Dialog
this.set_transient_for(parent);
this.modify_bg(StateType.NORMAL, white);
- this.add_buttons(_("Confirm"), ResponseType.OK,
- _("Cancel"), ResponseType.CANCEL);
+ this.add_buttons(_("Cancel"), ResponseType.CANCEL,
+ _("Confirm"), ResponseType.OK);
this.set_default_response(ResponseType.OK);
@@ -58,7 +56,7 @@ class TrustAnchorDialog : Dialog
Label dialog_label = new Label("");
dialog_label.set_alignment(0, 0);
- string label_markup = _("You are using this identity for the first time with the following trust anchor:");
+ string label_markup = "" + _("You are using this identity for the first time with the following trust anchor:") + "";
dialog_label.set_markup(label_markup);
dialog_label.set_line_wrap(true);
@@ -70,33 +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 fingerprint = new TextView();
- fingerprint.set_editable(false);
- var buffer = fingerprint.get_buffer();
- buffer.set_text(colonize(idcard.trust_anchor.server_cert), -1);
- fingerprint.wrap_mode = WrapMode.WORD_CHAR;
-
- set_atk_relation(fingerprint_label, fingerprint, Atk.RelationType.LABEL_FOR);
-
- var fingerprint_width_constraint = new ScrolledWindow(null, null);
- fingerprint_width_constraint.set_policy(PolicyType.NEVER, PolicyType.NEVER);
- fingerprint_width_constraint.set_shadow_type(ShadowType.IN);
- fingerprint_width_constraint.set_size_request(400, 60);
- fingerprint_width_constraint.add_with_viewport(fingerprint);
-
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(fingerprint_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);
@@ -120,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;
- }
}