From e0f0eed7f106405aa5570f98f3e0055132cf00ec Mon Sep 17 00:00:00 2001 From: Dan Breslau Date: Tue, 16 Aug 2016 17:45:46 -0400 Subject: [PATCH] Use the label text 'Do not use a Moonshot identity for this service' if displaying the ID Selector for ID selection --- src/moonshot-idcard-widget.vala | 9 +++++++-- src/moonshot-identity-management-view.vala | 18 +++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/moonshot-idcard-widget.vala b/src/moonshot-idcard-widget.vala index 0df4b95..9a63dae 100644 --- a/src/moonshot-idcard-widget.vala +++ b/src/moonshot-idcard-widget.vala @@ -35,6 +35,8 @@ class IdCardWidget : Box { static MoonshotLogger logger = get_logger("IdCardWidget"); + private IdentityManagerView manager_view; + public IdCard id_card { get; set; default = null; } private VBox main_vbox; private HBox table; @@ -125,7 +127,9 @@ class IdCardWidget : Box string services_text = _("Services: "); string service_spacer = _("\n "); - var label_text = Markup.printf_escaped(_("%s"), this.id_card.display_name); + var display_name = (manager_view.selection_in_progress() && this.id_card.is_no_identity() + ? "Do not use a Moonshot identity for this service" : this.id_card.display_name); + var label_text = Markup.printf_escaped(_("%s"), display_name); if (is_selected) { @@ -141,9 +145,10 @@ class IdCardWidget : Box label.set_markup(label_text); } - public IdCardWidget(IdCard id_card) + public IdCardWidget(IdCard id_card, IdentityManagerView manager_view) { this.id_card = id_card; + this.manager_view = manager_view; var image = new Image.from_pixbuf(get_pixbuf(id_card)); diff --git a/src/moonshot-identity-management-view.vala b/src/moonshot-identity-management-view.vala index fb36685..aebaec9 100644 --- a/src/moonshot-identity-management-view.vala +++ b/src/moonshot-identity-management-view.vala @@ -63,7 +63,7 @@ public class IdentityManagerView : Window { internal IdentityManagerModel identities_manager; private unowned SList candidates; - public GLib.Queue request_queue; + private GLib.Queue request_queue; internal CheckButton remember_identity_binding = null; @@ -296,7 +296,7 @@ public class IdentityManagerView : Window { 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); @@ -309,7 +309,7 @@ public class IdentityManagerView : Window { 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); } @@ -490,7 +490,7 @@ public class IdentityManagerView : Window { 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(); @@ -551,7 +551,7 @@ public class IdentityManagerView : Window { 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 @@ -564,7 +564,7 @@ public class IdentityManagerView : Window { candidates = null; - if (this.request_queue.is_empty()) + if (!this.selection_in_progress()) { candidates = null; clear_selection_prompts(); @@ -863,10 +863,14 @@ SUCH DAMAGE. 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(); -- 2.1.4