From abaf84cbf4dd9d7ce67605ff4e8bd51067bb0771 Mon Sep 17 00:00:00 2001 From: Dan Breslau Date: Fri, 19 Aug 2016 17:50:31 -0400 Subject: [PATCH] Fixed display of the no_identity widget, and don't allow it to be removed --- src/moonshot-idcard-widget.vala | 22 ++++++++++++++-------- src/moonshot-identity-management-view.vala | 9 ++++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/moonshot-idcard-widget.vala b/src/moonshot-idcard-widget.vala index 7ef6e2a..a697481 100644 --- a/src/moonshot-idcard-widget.vala +++ b/src/moonshot-idcard-widget.vala @@ -129,7 +129,6 @@ class IdCardWidget : Box update_id_card_label() { // !!TODO: Use a table to format the labels and values - string services_text = _("Services: "); string service_spacer = _("\n "); var display_name = (manager_view.selection_in_progress() && this.id_card.is_no_identity() @@ -138,12 +137,15 @@ class IdCardWidget : Box if (is_selected) { - label_text += "\nUsername: " + id_card.username; - label_text += "\nRealm: " + id_card.issuer; - if (!id_card.trust_anchor.is_empty()) { - label_text += _("\nTrust anchor: Enterprise provisioned"); + if (!this.id_card.is_no_identity()) { + label_text += "\nUsername: " + id_card.username; + label_text += "\nRealm: " + id_card.issuer; + if (!id_card.trust_anchor.is_empty()) { + label_text += _("\nTrust anchor: Enterprise provisioned"); + } } - services_text += this.id_card.get_services_string(service_spacer); + + string services_text = _("Services: ") + this.id_card.get_services_string(service_spacer); label_text += _("\n") + services_text; } @@ -155,14 +157,18 @@ class IdCardWidget : Box this.id_card = id_card; this.manager_view = manager_view; - var image = new Image.from_pixbuf(get_pixbuf(id_card)); - label = new Label(null); label.set_alignment((float) 0, (float) 0.5); label.set_ellipsize(Pango.EllipsizeMode.END); update_id_card_label(); table = new Gtk.HBox(false, 6); + var image = new Image.from_pixbuf(get_pixbuf(id_card)); + if (this.id_card.is_no_identity()) { + image.clear(); + // Use padding to make the image size = 48x48 (size = 2x padding) + image.set_padding(24, 24); + } table.pack_start(image, false, false, 0); table.pack_start(label, true, true, 0); this.arrow = new Arrow(ArrowType.RIGHT, ARROW_SHADOW); diff --git a/src/moonshot-identity-management-view.vala b/src/moonshot-identity-management-view.vala index b516f9f..1c7a384 100644 --- a/src/moonshot-identity-management-view.vala +++ b/src/moonshot-identity-management-view.vala @@ -305,7 +305,8 @@ public class IdentityManagerView : Window { private void widget_selected_cb(IdCardWidget id_card_widget) { - this.remove_button.set_sensitive(true); + bool allow_removes = !id_card_widget.id_card.is_no_identity(); + this.remove_button.set_sensitive(allow_removes); this.edit_button.set_sensitive(true); this.custom_vbox.receive_expanded_event(id_card_widget); @@ -490,7 +491,10 @@ public class IdentityManagerView : Window { public void queue_identity_request(IdentityRequest request) { - if (!this.selection_in_progress()) + bool queue_was_empty = !this.selection_in_progress(); + this.request_queue.push_tail(request); + + if (queue_was_empty) { /* setup widgets */ candidates = request.candidates; filter.refilter(); @@ -499,7 +503,6 @@ public class IdentityManagerView : Window { remember_identity_binding.show(); make_visible(); } - this.request_queue.push_tail(request); } -- 2.1.4