internal IdentityManagerModel identities_manager;
private unowned SList<IdCard> candidates;
- public GLib.Queue<IdentityRequest> request_queue;
+ private GLib.Queue<IdentityRequest> request_queue;
internal CheckButton remember_identity_binding = null;
id_card.update_services_from_list(dialog.get_services());
+ if (dialog.clear_trust_anchor) {
+ id_card.clear_trust_anchor();
+ }
+
return id_card;
}
private IdCardWidget add_id_card_widget(IdCard id_card)
{
- var id_card_widget = new IdCardWidget(id_card);
+ var id_card_widget = new IdCardWidget(id_card, this);
this.custom_vbox.add_id_card_widget(id_card_widget);
id_card_widget.expanded.connect(this.widget_selected_cb);
id_card_widget.collapsed.connect(this.widget_unselected_cb);
this.edit_button.set_sensitive(true);
this.custom_vbox.receive_expanded_event(id_card_widget);
- if (this.request_queue.length > 0)
+ if (this.selection_in_progress())
this.send_button.set_sensitive(true);
}
Gtk.MessageDialog dialog;
IdCard? prev_id = identities_manager.find_id_card(id_card.nai, force_flat_file_store);
logger.trace("add_identity(flat=%s, card='%s'): find_id_card returned %s"
- .printf(force_flat_file_store.to_string(), id_card.display_name, (prev_id != null ? "non-null" : "null")));
+ .printf(force_flat_file_store.to_string(), id_card.display_name, (prev_id != null ? prev_id.display_name : "null")));
if (prev_id!=null) {
int flags = prev_id.Compare(id_card);
logger.trace("add_identity: compare returned " + flags.to_string());
public void queue_identity_request(IdentityRequest request)
{
- if (this.request_queue.is_empty())
+ if (!this.selection_in_progress())
{ /* setup widgets */
candidates = request.candidates;
filter.refilter();
private void send_identity_cb(IdCard id)
{
- return_if_fail(request_queue.length > 0);
+ return_if_fail(this.selection_in_progress());
if (!check_and_confirm_trust_anchor(id)) {
// Allow user to pick again
candidates = null;
- if (this.request_queue.is_empty())
+ if (!this.selection_in_progress())
{
candidates = null;
clear_selection_prompts();
private bool check_and_confirm_trust_anchor(IdCard id)
{
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) {
+ if (!id.trust_anchor.user_verified) {
bool ret = false;
int result = ResponseType.CANCEL;
switch (result) {
case ResponseType.OK:
- set_string_setting("TrustAnchors", id.nai, id.trust_anchor.server_cert);
+ id.trust_anchor.user_verified = true;
ret = true;
break;
default:
add(main_vbox);
main_vbox.show_all();
- if (this.request_queue.length == 0)
+ if (!this.selection_in_progress())
remember_identity_binding.hide();
}
+ internal bool selection_in_progress() {
+ return !this.request_queue.is_empty();
+ }
+
private void set_atk_name_description(Widget widget, string name, string description)
{
var atk_widget = widget.get_accessible();
private void connect_signals()
{
- this.destroy.connect(Gtk.main_quit);
+ this.destroy.connect(() => {
+ logger.trace("Destroy event; calling Gtk.main_quit()");
+ Gtk.main_quit();
+ });
this.identities_manager.card_list_changed.connect(this.on_card_list_changed);
+ this.delete_event.connect(() => {return confirm_quit();});
+ }
+
+ private bool confirm_quit() {
+ logger.trace("delete_event intercepted; selection_in_progress()=" + selection_in_progress().to_string());
+
+ if (selection_in_progress()) {
+ var result = WarningDialog.confirm(this,
+ Markup.printf_escaped(
+ _("<span font-weight='heavy'>Do you wish to use the %s service?</span>"),
+ this.request_queue.peek_head().service)
+ + _("\n\nSelect Yes to select an ID for this service, or No to cancel"),
+ "close_moonshot_window");
+ if (result) {
+ // Prevent other handlers from handling this event; this keeps the window open.
+ return true;
+ }
+ }
+
+ // Allow the window deletion to proceed.
+ return false;
}
}