Merge branch 'adaptive_dialogs' into 'mainline'

Make account-editor adaptive

See merge request GNOME/geary!609
This commit is contained in:
Michael Gratton 2021-01-07 21:54:57 +00:00
commit bf3a0e830b
13 changed files with 514 additions and 686 deletions

View file

@ -526,7 +526,7 @@ private abstract class Accounts.EntryRow : AddPaneRow<Gtk.Entry> {
this.value.text = initial_value ?? "";
this.value.placeholder_text = placeholder ?? "";
this.value.width_chars = 32;
this.value.width_chars = 16;
this.undo = new Components.EntryUndo(this.value);
}

View file

@ -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();
}
}
@ -376,7 +397,9 @@ private class Accounts.MailboxRow : AccountRow<EditorEditPane,Gtk.Label> {
public MailboxRow(Geary.AccountInformation account,
Geary.RFC822.MailboxAddress mailbox) {
base(account, "", new Gtk.Label(""));
var label = new Gtk.Label("");
label.ellipsize = Pango.EllipsizeMode.END;
base(account, "", label);
this.mailbox = mailbox;
enable_drag();

View file

@ -1,74 +0,0 @@
/*
* Copyright 2018-2019 Michael Gratton <mike@vee.net>
*
* 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();
}
}

View file

@ -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',