From 509db435265cd41655adf4d4d31337381678b1f6 Mon Sep 17 00:00:00 2001 From: Dan Breslau Date: Fri, 5 Aug 2016 17:07:46 -0400 Subject: [PATCH] Fixed (again) how the Add, Edit, Remove, and Send buttons are enabled/disabled --- src/moonshot-identity-management-view.vala | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/moonshot-identity-management-view.vala b/src/moonshot-identity-management-view.vala index 054be47..93129e8 100644 --- a/src/moonshot-identity-management-view.vala +++ b/src/moonshot-identity-management-view.vala @@ -286,6 +286,7 @@ public class IdentityManagerView : Window { var id_card_widget = new IdCardWidget(id_card); 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); return id_card_widget; } @@ -299,6 +300,15 @@ public class IdentityManagerView : Window { this.send_button.set_sensitive(true); } + private void widget_unselected_cb(IdCardWidget id_card_widget) + { + this.remove_button.set_sensitive(false); + this.edit_button.set_sensitive(false); + this.custom_vbox.receive_collapsed_event(id_card_widget); + + this.send_button.set_sensitive(false); + } + public bool add_identity(IdCard id_card, bool force_flat_file_store) { #if OS_MACOS @@ -428,8 +438,9 @@ public class IdentityManagerView : Window { var id_card = id_card_widget.id_card; bool remove = WarningDialog.confirm(this, - "You are about to remove the identity '%s'." - .printf(id_card.display_name) + Markup.printf_escaped( + "You are about to remove the identity '%s'.", + id_card.display_name) + "\n\nAre you sure you want to do this?", "delete_idcard"); if (remove) @@ -525,6 +536,8 @@ public class IdentityManagerView : Window { private void send_identity_cb(IdCard id) { + send_button.set_sensitive(false); + IdCard identity = id; return_if_fail(request_queue.length > 0); @@ -749,7 +762,7 @@ SUCH DAMAGE. remove_button.clicked.connect((w) => {remove_identity_cb(custom_vbox.current_idcard);}); remove_button.set_sensitive(false); - send_button = new Button.with_label(_("Send")); + this.send_button = new Button.with_label(_("Send")); send_button.clicked.connect((w) => {send_identity_cb(custom_vbox.current_idcard.id_card);}); // send_button.set_visible(false); send_button.set_sensitive(false); -- 2.1.4