From a30afb9e861450f042fd0d1e52ab6b965a247065 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Wed, 14 Oct 2020 14:44:26 +0200 Subject: [PATCH 7/8] account-editor: replace remove confirm view with dialog --- po/POTFILES.in | 1 - .../accounts/accounts-editor-edit-pane.vala | 23 ++- .../accounts/accounts-editor-remove-pane.vala | 74 -------- src/client/meson.build | 1 - ui/accounts_editor_remove_pane.ui | 159 ------------------ ui/geary.css | 8 + ui/org.gnome.Geary.gresource.xml | 1 - 7 files changed, 30 insertions(+), 237 deletions(-) delete mode 100644 src/client/accounts/accounts-editor-remove-pane.vala delete mode 100644 ui/accounts_editor_remove_pane.ui diff --git a/po/POTFILES.in b/po/POTFILES.in index cd8b339d..d9dcb0b7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,7 +9,6 @@ src/client/accounts/accounts-editor.vala src/client/accounts/accounts-editor-add-pane.vala src/client/accounts/accounts-editor-edit-pane.vala src/client/accounts/accounts-editor-list-pane.vala -src/client/accounts/accounts-editor-remove-pane.vala src/client/accounts/accounts-editor-row.vala src/client/accounts/accounts-editor-servers-pane.vala src/client/accounts/accounts-manager.vala diff --git a/src/client/accounts/accounts-editor-edit-pane.vala b/src/client/accounts/accounts-editor-edit-pane.vala index 5b944333..405dc7ba 100644 --- a/src/client/accounts/accounts-editor-edit-pane.vala +++ b/src/client/accounts/accounts-editor-edit-pane.vala @@ -217,7 +217,28 @@ internal class Accounts.EditorEditPane : [GtkCallback] private void on_remove_account_clicked() { if (!this.editor.accounts.is_goa_account(account)) { - this.editor.push(new EditorRemovePane(this.editor, this.account)); + var button = new Gtk.Button.with_mnemonic(_("Remove Account")); + button.get_style_context().add_class(Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + button.show(); + + var dialog = new Gtk.MessageDialog(this.editor, + Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.WARNING, + Gtk.ButtonsType.NONE, + _("Remove Account: %s"), + account.primary_mailbox.address); + dialog.secondary_text = _("This will remove it from Geary and delete locally cached email data from your computer. Nothing will be deleted from your service provider."); + + dialog.add_button (_("_Cancel"), Gtk.ResponseType.CANCEL); + dialog.add_action_widget(button, Gtk.ResponseType.ACCEPT); + + dialog.response.connect((response_id) => { + if (response_id == Gtk.ResponseType.ACCEPT) + this.editor.remove_account(this.account); + + dialog.destroy(); + }); + dialog.show(); } } diff --git a/src/client/accounts/accounts-editor-remove-pane.vala b/src/client/accounts/accounts-editor-remove-pane.vala deleted file mode 100644 index 2a6844cd..00000000 --- a/src/client/accounts/accounts-editor-remove-pane.vala +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2018-2019 Michael Gratton - * - * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. - */ - -/** - * An account editor pane for removing an account from the client. - */ -[GtkTemplate (ui = "/org/gnome/Geary/accounts_editor_remove_pane.ui")] -internal class Accounts.EditorRemovePane : Gtk.Grid, EditorPane, AccountPane { - - - /** {@inheritDoc} */ - internal weak Accounts.Editor editor { get; set; } - - /** {@inheritDoc} */ - internal Geary.AccountInformation account { get ; protected set; } - - /** {@inheritDoc} */ - internal Gtk.Widget initial_widget { - get { return this.remove_button; } - } - - /** {@inheritDoc} */ - internal bool is_operation_running { get; protected set; default = false; } - - /** {@inheritDoc} */ - internal GLib.Cancellable? op_cancellable { - get; protected set; default = null; - } - - [GtkChild] - private Gtk.HeaderBar header; - - [GtkChild] - private Gtk.Label warning_label; - - [GtkChild] - private Gtk.Button remove_button; - - - public EditorRemovePane(Editor editor, Geary.AccountInformation account) { - this.editor = editor; - this.account = account; - - this.warning_label.set_text( - this.warning_label.get_text().printf(account.display_name) - ); - - connect_account_signals(); - } - - ~EditorRemovePane() { - disconnect_account_signals(); - } - - /** {@inheritDoc} */ - internal Gtk.HeaderBar get_header() { - return this.header; - } - - [GtkCallback] - private void on_remove_button_clicked() { - this.editor.remove_account(this.account); - } - - [GtkCallback] - private void on_back_button_clicked() { - this.editor.pop(); - } - -} diff --git a/src/client/meson.build b/src/client/meson.build index 4efadc6d..6514adca 100644 --- a/src/client/meson.build +++ b/src/client/meson.build @@ -38,7 +38,6 @@ client_vala_sources = files( 'accounts/accounts-editor-add-pane.vala', 'accounts/accounts-editor-edit-pane.vala', 'accounts/accounts-editor-list-pane.vala', - 'accounts/accounts-editor-remove-pane.vala', 'accounts/accounts-editor-row.vala', 'accounts/accounts-editor-servers-pane.vala', 'accounts/accounts-signature-web-view.vala', diff --git a/ui/accounts_editor_remove_pane.ui b/ui/accounts_editor_remove_pane.ui deleted file mode 100644 index 7edf4c13..00000000 --- a/ui/accounts_editor_remove_pane.ui +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - True - False - Remove account - Account name - True - - - True - False - - - True - True - True - - - - True - False - True - go-previous-symbolic - - - - - 0 - 0 - - - - - - diff --git a/ui/geary.css b/ui/geary.css index ca3cf640..3877038f 100644 --- a/ui/geary.css +++ b/ui/geary.css @@ -334,6 +334,14 @@ popover.geary-editor > grid > button.geary-setting-remove { margin-top: 12px; } +dialog.geary-remove-confirm .dialog-vbox { + margin: 12px; +} + +dialog.geary-remove-confirm .dialog-action-box { + margin: 6px; +} + /* FolderList.Tree */ treeview.sidebar:drop(active).after, diff --git a/ui/org.gnome.Geary.gresource.xml b/ui/org.gnome.Geary.gresource.xml index 0b9e900f..efdc87d6 100644 --- a/ui/org.gnome.Geary.gresource.xml +++ b/ui/org.gnome.Geary.gresource.xml @@ -5,7 +5,6 @@ accounts_editor_add_pane.ui accounts_editor_edit_pane.ui accounts_editor_list_pane.ui - accounts_editor_remove_pane.ui accounts_editor_servers_pane.ui application-main-window.ui certificate_warning_dialog.glade -- 2.29.2