aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink <dennis.fink@c3l.lu>2017-10-30 17:08:19 +0100
committerfiaxh <fiaxh@users.noreply.github.com>2017-10-30 19:09:36 +0100
commita45ba285413a40740275ff91a38eb7f513488eff (patch)
treee8053bb6c0fc66f7cf8170ddce740303d8c5aa67
parent193ca0b671370e63cbc22a4b17e3b04e96c1870a (diff)
downloaddino-a45ba285413a40740275ff91a38eb7f513488eff.tar.gz
dino-a45ba285413a40740275ff91a38eb7f513488eff.zip
Added a confirmation dialog before removing an account. Fixes #51
-rw-r--r--main/src/ui/manage_accounts/dialog.vala24
1 files changed, 16 insertions, 8 deletions
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala
index 62b797fa..af9686c8 100644
--- a/main/src/ui/manage_accounts/dialog.vala
+++ b/main/src/ui/manage_accounts/dialog.vala
@@ -126,15 +126,23 @@ public class Dialog : Gtk.Dialog {
}
private void remove_account(AccountRow account_item) {
- account_list.remove(account_item);
- account_list.queue_draw();
- if (account_item.account.enabled) account_disabled(account_item.account);
- account_item.account.remove();
- if (account_list.get_row_at_index(0) != null) {
- account_list.select_row(account_list.get_row_at_index(0));
- } else {
- main_stack.set_visible_child_name("no_accounts");
+ Gtk.MessageDialog msg = new Gtk.MessageDialog (
+ this, Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.MODAL,
+ Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO,
+ _("Delete Account"));
+ msg.format_secondary_markup(_("Do you really want to delete <b>%s</b>? This action is irreversible!"), account_item.jid_label.get_text());
+ if (msg.run() == Gtk.ResponseType.YES) {
+ account_list.remove(account_item);
+ account_list.queue_draw();
+ if (account_item.account.enabled) account_disabled(account_item.account);
+ account_item.account.remove();
+ if (account_list.get_row_at_index(0) != null) {
+ account_list.select_row(account_list.get_row_at_index(0));
+ } else {
+ main_stack.set_visible_child_name("no_accounts");
+ }
}
+ msg.close();
}
private void on_account_list_row_selected(ListBoxRow? row) {