public class IdentityManagerView : Window {
static MoonshotLogger logger = get_logger("IdentityManagerView");
+ // The latest year in which Moonshot sources were modified.
+ private static int LATEST_EDIT_YEAR = 2016;
+
+ public static Gdk.Color white = make_color(65535, 65535, 65535);
+
private const int WINDOW_WIDTH = 700;
private const int WINDOW_HEIGHT = 500;
protected IdentityManagerApp parent_app;
private void send_identity_cb(IdCard id)
{
- send_button.set_sensitive(false);
-
- IdCard identity = id;
return_if_fail(request_queue.length > 0);
- candidates = null;
+ if (!check_and_confirm_trust_anchor(id)) {
+ // Allow user to pick again
+ return;
+ }
+
var request = this.request_queue.pop_head();
- identity = check_add_password(identity, request, identities_manager);
+ var identity = check_add_password(id, request, identities_manager);
+ send_button.set_sensitive(false);
+
+ candidates = null;
+
if (this.request_queue.is_empty())
{
candidates = null;
remember_identity_binding.hide();
}
+ 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 (get_string_setting("TrustAnchors", id.nai) != id.trust_anchor.server_cert) {
+
+ bool ret = false;
+ int result = ResponseType.CANCEL;
+ var dialog = new TrustAnchorDialog(id, this);
+ while (!dialog.complete)
+ result = dialog.run();
+
+ switch (result) {
+ case ResponseType.OK:
+ set_string_setting("TrustAnchors", id.nai, id.trust_anchor.server_cert);
+ ret = true;
+ break;
+ default:
+ break;
+ }
+
+ dialog.destroy();
+ return ret;
+ }
+ }
+ return true;
+ }
+
+
// private void label_make_bold(Label label)
// {
// var font_desc = new Pango.FontDescription();
private void on_about_action()
{
- string copyright = "Copyright 2011, 2016 JANET";
+ string copyright = "Copyright (c) 2011, %d JANET".printf(LATEST_EDIT_YEAR);
string license =
"""
-Copyright (c) 2011, 2016 JANET(UK)
+Copyright (c) 2011, %d JANET(UK)
All rights reserved.
Redistribution and use in source and binary forms, with or without
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-""";
-
- Gtk.show_about_dialog(this,
- "comments", _("Moonshot project UI"),
- "copyright", copyright,
- "website", Config.PACKAGE_URL,
- "version", Config.PACKAGE_VERSION,
- "license", license,
- "website-label", _("Visit the Moonshot project web site"),
- "translator-credits", _("translator-credits"),
- null
- );
+""".printf(LATEST_EDIT_YEAR);
+
+ AboutDialog about = new AboutDialog();
+
+ about.set_comments(_("Moonshot project UI"));
+ about.set_copyright(copyright);
+ about.set_website(Config.PACKAGE_URL);
+ about.set_website_label(_("Visit the Moonshot project web site"));
+
+ // Note: The package version is configured at the top of moonshot/ui/configure.ac
+ about.set_version(Config.PACKAGE_VERSION);
+ about.set_license(license);
+ about.set_modal(true);
+ about.set_transient_for(this);
+ about.response.connect((a, b) => {about.destroy();});
+ about.modify_bg(StateType.NORMAL, white);
+
+ about.run();
}
private Gtk.ActionEntry[] create_actions() {
private void build_ui()
{
// Note: On Debian7/Gtk+2, the menu bar remains gray. This doesn't happen on Debian8/Gtk+3.
- Gdk.Color white = Gdk.Color();
- white.red = white.green = white.blue = 65535;
this.modify_bg(StateType.NORMAL, white);
create_ui_manager();