[geary: 7/9] account-editor: replace remove confirm view with dialog




commit a30afb9e861450f042fd0d1e52ab6b965a247065
Author: Julian Sparber <julian sparber net>
Date:   Wed Oct 14 14:44:26 2020 +0200

    account-editor: replace remove confirm view with dialog

 po/POTFILES.in                                     |   1 -
 src/client/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(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cd8b339d9..d9dcb0b77 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 5b9443336..405dc7bac 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/meson.build b/src/client/meson.build
index 4efadc6de..6514adcae 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/geary.css b/ui/geary.css
index ca3cf640b..3877038ff 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 0b9e900fd..efdc87d67 100644
--- a/ui/org.gnome.Geary.gresource.xml
+++ b/ui/org.gnome.Geary.gresource.xml
@@ -5,7 +5,6 @@
     <file compressed="true" preprocess="xml-stripblanks">accounts_editor_add_pane.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">accounts_editor_edit_pane.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">accounts_editor_list_pane.ui</file>
-    <file compressed="true" preprocess="xml-stripblanks">accounts_editor_remove_pane.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">accounts_editor_servers_pane.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">application-main-window.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">certificate_warning_dialog.glade</file>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]