Commit 1bccd51a authored by Michael Gratton's avatar Michael Gratton 🤞

Clean up AccountInformation and ServiceInformation APIs

Remove remaining crufty properties left over from pulling accounts out
of the engine, rename imap/smtp to incoming/outgoing since maybe one
day other protocols or implementations will be supported. Remove the
old pairs of properties for TLS and SMTP auth, replace the
SmtpCredentials enum with something that is also independent of
protocol.
parent e4253233
......@@ -168,10 +168,8 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
)
);
account.imap = new_imap_service();
account.imap = new_smtp_service();
account.nickname = account.primary_mailbox.address;
account.incoming = new_imap_service();
account.outgoing = new_smtp_service();
if (this.provider == Geary.ServiceProvider.OTHER) {
bool imap_valid = false;
......@@ -179,7 +177,7 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
try {
yield this.engine.validate_imap(
account, account.imap, cancellable
account, account.incoming, cancellable
);
imap_valid = true;
} catch (Geary.ImapError.UNAUTHENTICATED err) {
......@@ -200,8 +198,8 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
try {
yield this.engine.validate_smtp(
account,
account.smtp,
account.imap.credentials,
account.outgoing,
account.incoming.credentials,
cancellable
);
smtp_valid = true;
......@@ -210,7 +208,8 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
// There was an SMTP auth error, but IMAP already
// succeeded, so the user probably needs to
// specify custom creds here
this.smtp_auth.value.source = Geary.SmtpCredentials.CUSTOM;
this.smtp_auth.value.source =
Geary.Credentials.Requirement.CUSTOM;
to_focus = this.smtp_login.value;
// Translators: In-app notification label
message = _("Check your sending login and password");
......@@ -227,7 +226,7 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
} else {
try {
yield this.engine.validate_imap(
account, account.imap, cancellable
account, account.incoming, cancellable
);
is_valid = true;
} catch (Geary.ImapError.UNAUTHENTICATED err) {
......@@ -316,26 +315,14 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
new Geary.ServiceInformation(Geary.Protocol.SMTP);
if (this.provider == Geary.ServiceProvider.OTHER) {
switch (this.smtp_auth.value.source) {
case Geary.SmtpCredentials.NONE:
service.smtp_noauth = true;
service.smtp_use_imap_credentials = false;
break;
case Geary.SmtpCredentials.IMAP:
service.smtp_noauth = false;
service.smtp_use_imap_credentials = true;
break;
case Geary.SmtpCredentials.CUSTOM:
service.smtp_noauth = false;
service.smtp_use_imap_credentials = false;
service.credentials_requirement = this.smtp_auth.value.source;
if (service.credentials_requirement ==
Geary.Credentials.Requirement.CUSTOM) {
service.credentials = new Geary.Credentials(
Geary.Credentials.Method.PASSWORD,
this.smtp_login.value.get_text().strip(),
this.smtp_password.value.get_text().strip()
);
break;
}
Components.NetworkAddressValidator host =
......@@ -350,9 +337,6 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
if (service.port == 0) {
service.port = service.get_default_port();
}
debug("SMTP service: TLS: %s, STARTTLS: %s",
service.use_ssl.to_string(), service.use_starttls.to_string());
} else {
this.provider.setup_service(service);
}
......@@ -406,7 +390,7 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
}
private void on_smtp_auth_changed() {
if (this.smtp_auth.value.source == Geary.SmtpCredentials.CUSTOM) {
if (this.smtp_auth.value.source == Geary.Credentials.Requirement.CUSTOM) {
this.sending_list.add(this.smtp_login);
this.sending_list.add(this.smtp_password);
} else if (this.smtp_login.parent != null) {
......@@ -621,7 +605,7 @@ private class Accounts.SmtpAuthRow :
base(value.label, value);
this.activatable = false;
this.value.source = Geary.SmtpCredentials.IMAP;
this.value.source = Geary.Credentials.Requirement.USE_INCOMING;
}
}
......@@ -59,7 +59,7 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane {
this.pane_content.set_focus_vadjustment(this.pane_adjustment);
this.details_list.set_header_func(Editor.seperator_headers);
this.details_list.add(new NicknameRow(account));
this.details_list.add(new DisplayNameRow(account));
this.senders_list.set_header_func(Editor.seperator_headers);
foreach (Geary.RFC822.MailboxAddress sender in
......@@ -101,7 +101,7 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane {
this.signature_preview.show();
this.signature_preview.load_html(
Geary.HTML.smart_escape(account.email_signature)
Geary.HTML.smart_escape(account.signature)
);
this.signature_frame.add(this.signature_preview);
......@@ -113,7 +113,7 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane {
!this.editor.accounts.is_goa_account(account)
);
this.account.information_changed.connect(on_account_changed);
this.account.changed.connect(on_account_changed);
update_header();
this.commands.executed.connect(on_command);
......@@ -122,7 +122,7 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane {
}
~EditorEditPane() {
this.account.information_changed.disconnect(on_account_changed);
this.account.changed.disconnect(on_account_changed);
this.commands.executed.disconnect(on_command);
this.commands.undone.disconnect(on_command);
......@@ -270,10 +270,10 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane {
}
private class Accounts.NicknameRow : AccountRow<EditorEditPane,Gtk.Label> {
private class Accounts.DisplayNameRow : AccountRow<EditorEditPane,Gtk.Label> {
public NicknameRow(Geary.AccountInformation account) {
public DisplayNameRow(Geary.AccountInformation account) {
base(
account,
// Translators: Label in the account editor for the user's
......@@ -287,7 +287,7 @@ private class Accounts.NicknameRow : AccountRow<EditorEditPane,Gtk.Label> {
public override void activated(EditorEditPane pane) {
EditorPopover popover = new EditorPopover();
string? value = this.account.nickname;
string? value = this.account.display_name;
Gtk.Entry entry = new Gtk.Entry();
entry.set_text(value ?? "");
entry.set_placeholder_text(value ?? "");
......@@ -297,7 +297,7 @@ private class Accounts.NicknameRow : AccountRow<EditorEditPane,Gtk.Label> {
new PropertyCommand<string>(
this.account,
this.account,
Geary.AccountInformation.PROP_NICKNAME,
"label",
entry.get_text(),
// Translators: Tooltip used to undo changing
// the name of an account. The string
......@@ -317,7 +317,7 @@ private class Accounts.NicknameRow : AccountRow<EditorEditPane,Gtk.Label> {
}
public override void update() {
this.value.set_text(this.account.nickname);
this.value.set_text(this.account.display_name);
}
}
......@@ -559,13 +559,13 @@ internal class Accounts.AppendMailboxCommand : Application.Command {
public async override void execute(GLib.Cancellable? cancellable) {
this.senders_list.insert(this.new_row, this.mailbox_index);
this.new_row.account.append_sender(this.new_row.mailbox);
this.new_row.account.information_changed();
this.new_row.account.changed();
}
public async override void undo(GLib.Cancellable? cancellable) {
this.senders_list.remove(this.new_row);
this.new_row.account.remove_sender(this.new_row.mailbox);
this.new_row.account.information_changed();
this.new_row.account.changed();
}
}
......@@ -602,14 +602,14 @@ internal class Accounts.UpdateMailboxCommand : Application.Command {
this.row.mailbox = this.new_mailbox;
this.row.account.remove_sender(this.old_mailbox);
this.row.account.insert_sender(this.mailbox_index, this.new_mailbox);
this.row.account.information_changed();
this.row.account.changed();
}
public async override void undo(GLib.Cancellable? cancellable) {
this.row.mailbox = this.old_mailbox;
this.row.account.remove_sender(this.new_mailbox);
this.row.account.insert_sender(this.mailbox_index, this.old_mailbox);
this.row.account.information_changed();
this.row.account.changed();
}
}
......@@ -688,13 +688,13 @@ internal class Accounts.RemoveMailboxCommand : Application.Command {
public async override void execute(GLib.Cancellable? cancellable) {
this.list.remove(this.row);
this.row.account.remove_sender(this.mailbox);
this.row.account.information_changed();
this.row.account.changed();
}
public async override void undo(GLib.Cancellable? cancellable) {
this.list.insert(this.row, this.mailbox_index);
this.row.account.insert_sender(this.mailbox_index, this.mailbox);
this.row.account.information_changed();
this.row.account.changed();
}
}
......@@ -715,7 +715,7 @@ internal class Accounts.SignatureChangedCommand : Application.Command {
this.signature_view = signature_view;
this.account = account;
this.old_value = Geary.HTML.smart_escape(account.email_signature);
this.old_value = Geary.HTML.smart_escape(account.signature);
// Translators: Label used as the undo tooltip after removing
// a sender address from an account. The string substitution
......@@ -740,8 +740,8 @@ internal class Accounts.SignatureChangedCommand : Application.Command {
}
private inline void update_account_signature(string value) {
this.account.email_signature = value;
this.account.information_changed();
this.account.signature = value;
this.account.changed();
}
}
......
......@@ -310,13 +310,13 @@ private class Accounts.AccountListRow : AccountRow<EditorListPane,Gtk.Grid> {
this.service_label.show();
this.account.information_changed.connect(on_account_changed);
this.account.changed.connect(on_account_changed);
update();
update_status(status);
}
~AccountListRow() {
this.account.information_changed.disconnect(on_account_changed);
this.account.changed.disconnect(on_account_changed);
}
public override void activated(EditorListPane pane) {
......@@ -345,7 +345,7 @@ private class Accounts.AccountListRow : AccountRow<EditorListPane,Gtk.Grid> {
}
public override void update() {
string name = this.account.nickname;
string name = this.account.display_name;
if (Geary.String.is_empty(name)) {
name = account.primary_mailbox.to_address_display("", "");
}
......@@ -513,7 +513,7 @@ internal class Accounts.ReorderAccountCommand : Application.Command {
foreach (Geary.AccountInformation account in accounts) {
if (account.ordinal != ord) {
account.ordinal = ord;
account.information_changed();
account.changed();
}
ord++;
}
......@@ -539,12 +539,16 @@ internal class Accounts.RemoveAccountCommand : Application.Command {
// Translators: Notification shown after removing an
// account. The string substitution is the name of the
// account.
this.executed_label = _("Account “%s” removed").printf(account.nickname);
this.executed_label = _("Account “%s” removed").printf(
account.display_name
);
// Translators: Notification shown after removing an account
// is undone. The string substitution is the name of the
// account.
this.undone_label = _("Account “%s” restored").printf(account.nickname);
this.undone_label = _("Account “%s” restored").printf(
account.display_name
);
}
public async override void execute(GLib.Cancellable? cancellable)
......
......@@ -28,15 +28,15 @@ internal class Accounts.EditorRemovePane : Gtk.Grid, EditorPane, AccountPane {
this.account = account;
this.warning_label.set_text(
this.warning_label.get_text().printf(account.nickname)
this.warning_label.get_text().printf(account.display_name)
);
this.account.information_changed.connect(on_account_changed);
this.account.changed.connect(on_account_changed);
update_header();
}
~EditorRemovePane() {
this.account.information_changed.disconnect(on_account_changed);
this.account.changed.disconnect(on_account_changed);
}
internal Gtk.HeaderBar get_header() {
......
......@@ -304,13 +304,13 @@ internal abstract class Accounts.AccountRow<PaneType,V> :
public AccountRow(Geary.AccountInformation account, string label, V value) {
base(label, value);
this.account = account;
this.account.information_changed.connect(on_account_changed);
this.account.changed.connect(on_account_changed);
set_dim_label(true);
}
~AccountRow() {
this.account.information_changed.disconnect(on_account_changed);
this.account.changed.disconnect(on_account_changed);
}
public abstract void update();
......@@ -449,12 +449,12 @@ internal class Accounts.SmtpAuthComboBox : Gtk.ComboBoxText {
public string label { get; private set; }
public Geary.SmtpCredentials source {
public Geary.Credentials.Requirement source {
get {
try {
return Geary.SmtpCredentials.for_value(this.active_id);
return Geary.Credentials.Requirement.for_value(this.active_id);
} catch {
return Geary.SmtpCredentials.IMAP;
return Geary.Credentials.Requirement.USE_INCOMING;
}
}
set {
......@@ -469,19 +469,29 @@ internal class Accounts.SmtpAuthComboBox : Gtk.ComboBoxText {
// account
this.label = _("Login");
// Translators: ComboBox value for source of SMTP
// authentication credentials (none) when adding a new account
append(Geary.SmtpCredentials.NONE.to_value(), _("No login needed"));
append(
Geary.Credentials.Requirement.NONE.to_value(),
// Translators: ComboBox value for source of SMTP
// authentication credentials (none) when adding a new
// account
_("No login needed")
);
// Translators: ComboBox value for source of SMTP
// authentication credentials (use IMAP) when adding a new
// account
append(Geary.SmtpCredentials.IMAP.to_value(), _("Use IMAP login"));
append(
Geary.Credentials.Requirement.USE_INCOMING.to_value(),
// Translators: ComboBox value for source of SMTP
// authentication credentials (use IMAP) when adding a new
// account
_("Use incoming server login")
);
// Translators: ComboBox value for source of SMTP
// authentication credentials (custom) when adding a new
// account
append(Geary.SmtpCredentials.CUSTOM.to_value(), _("Use different login"));
append(
Geary.Credentials.Requirement.CUSTOM.to_value(),
// Translators: ComboBox value for source of SMTP
// authentication credentials (custom) when adding a new
// account
_("Use different login")
);
}
}
......@@ -626,12 +636,12 @@ internal class PropertyCommand<T> : Application.Command {
public async override void execute(GLib.Cancellable? cancellable) {
this.object.set(this.property_name, this.new_value);
this.account.information_changed();
this.account.changed();
}
public async override void undo(GLib.Cancellable? cancellable) {
this.object.set(this.property_name, this.old_value);
this.account.information_changed();
this.account.changed();
}
}
......@@ -3,7 +3,7 @@
* Copyright 2018 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.
* (version 2.1 or later). See the COPYING file in this distribution.
*/
/**
......@@ -21,8 +21,8 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
// These are copies of the originals that can be updated before
// validating on apply, without breaking anything.
private Geary.ServiceInformation imap_mutable;
private Geary.ServiceInformation smtp_mutable;
private Geary.ServiceInformation incoming_mutable;
private Geary.ServiceInformation outgoing_mutable;
[GtkChild]
......@@ -61,8 +61,8 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
this.editor = editor;
this.account = account;
this.engine = ((GearyApplication) editor.application).engine;
this.imap_mutable = new Geary.ServiceInformation.copy(account.imap);
this.smtp_mutable = new Geary.ServiceInformation.copy(account.smtp);
this.incoming_mutable = new Geary.ServiceInformation.copy(account.incoming);
this.outgoing_mutable = new Geary.ServiceInformation.copy(account.outgoing);
this.pane_content.set_focus_vadjustment(this.pane_adjustment);
......@@ -85,29 +85,29 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
this.details_list.add(this.save_drafts);
this.receiving_list.set_header_func(Editor.seperator_headers);
this.receiving_list.add(new ServiceHostRow(account, this.imap_mutable));
this.receiving_list.add(new ServiceSecurityRow(account, this.imap_mutable));
this.receiving_list.add(new ServiceLoginRow(account, this.imap_mutable));
this.receiving_list.add(new ServiceHostRow(account, this.incoming_mutable));
this.receiving_list.add(new ServiceSecurityRow(account, this.incoming_mutable));
this.receiving_list.add(new ServiceLoginRow(account, this.incoming_mutable));
this.sending_list.set_header_func(Editor.seperator_headers);
this.sending_list.add(new ServiceHostRow(account, this.smtp_mutable));
this.sending_list.add(new ServiceSecurityRow(account, this.smtp_mutable));
this.sending_list.add(new ServiceHostRow(account, this.outgoing_mutable));
this.sending_list.add(new ServiceSecurityRow(account, this.outgoing_mutable));
this.smtp_auth = new ServiceSmtpAuthRow(
account, this.smtp_mutable, this.imap_mutable
account, this.outgoing_mutable, this.incoming_mutable
);
this.smtp_auth.value.changed.connect(on_smtp_auth_changed);
this.sending_list.add(this.smtp_auth);
this.smtp_login = new ServiceLoginRow(account, this.smtp_mutable);
this.smtp_login = new ServiceLoginRow(account, this.outgoing_mutable);
this.sending_list.add(this.smtp_login);
this.account.information_changed.connect(on_account_changed);
this.account.changed.connect(on_account_changed);
update_header();
update_smtp_auth();
}
~EditorServersPane() {
this.account.information_changed.disconnect(on_account_changed);
this.account.changed.disconnect(on_account_changed);
}
internal Gtk.HeaderBar get_header() {
......@@ -128,10 +128,10 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
if (is_valid) {
try {
has_changed = this.engine.update_account_service(
this.account, imap_mutable
this.account, incoming_mutable
);
has_changed = this.engine.update_account_service(
this.account, smtp_mutable
this.account, outgoing_mutable
);
} catch (Geary.EngineError err) {
warning("Could not update account services: %s", err.message);
......@@ -146,7 +146,7 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
}
if (has_changed) {
this.account.information_changed();
this.account.changed();
}
this.editor.pop();
......@@ -162,7 +162,7 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
bool imap_valid = false;
try {
yield this.engine.validate_imap(
this.account, this.imap_mutable, cancellable
this.account, this.incoming_mutable, cancellable
);
imap_valid = true;
} catch (Geary.ImapError.UNAUTHENTICATED err) {
......@@ -181,8 +181,8 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
try {
yield this.engine.validate_smtp(
this.account,
this.smtp_mutable,
this.imap_mutable.credentials,
this.outgoing_mutable,
this.incoming_mutable.credentials,
cancellable
);
smtp_valid = true;
......@@ -191,7 +191,7 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
// There was an SMTP auth error, but IMAP already
// succeeded, so the user probably needs to
// specify custom creds here
this.smtp_auth.value.source = Geary.SmtpCredentials.CUSTOM;
this.smtp_auth.value.source = Geary.Credentials.Requirement.CUSTOM;
// Translators: In-app notification label
message = _("Check your sending login and password");
} catch (GLib.Error err) {
......@@ -224,7 +224,7 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane {
private void update_smtp_auth() {
this.smtp_login.set_visible(
this.smtp_auth.value.source == Geary.SmtpCredentials.CUSTOM
this.smtp_auth.value.source == Geary.Credentials.Requirement.CUSTOM
);
}
......@@ -575,8 +575,9 @@ private class Accounts.ServiceLoginRow :
label = method.printf(login);
} else if (this.service.protocol == Geary.Protocol.SMTP &&
this.service.smtp_use_imap_credentials) {
label = _("Use IMAP login");
this.service.credentials_requirement ==
Geary.Credentials.Requirement.USE_INCOMING) {
label = _("Use incoming server login");
} else {
// Translators: Label used when no auth scheme is used
// by an account's IMAP or SMTP service.
......@@ -614,11 +615,11 @@ private class Accounts.ServiceSmtpAuthRow :
}
public override void update() {
this.value.source = this.service.smtp_credentials_source;
this.value.source = this.service.credentials_requirement;
}
private void on_value_changed() {
if (this.service.smtp_credentials_source != this.value.source) {
if (this.service.credentials_requirement != this.value.source) {
// The default SMTP port also depends on the auth method
// used, so also update the port here if we're currently
// using the default, otherwise keep the custom port
......@@ -626,9 +627,9 @@ private class Accounts.ServiceSmtpAuthRow :
bool update_port = (
this.service.port == this.service.get_default_port()
);
this.service.smtp_credentials_source = this.value.source;
this.service.credentials_requirement = this.value.source;
this.service.credentials =
(this.service.smtp_credentials_source != CUSTOM)
(this.service.credentials_requirement != CUSTOM)
? null
: new Geary.Credentials(Geary.Credentials.Method.PASSWORD, "");
if (update_port) {
......
......@@ -216,7 +216,7 @@ internal interface Accounts.AccountPane : Gtk.Grid, EditorPane {
protected void update_header() {
get_header().subtitle = this.account.nickname;
get_header().subtitle = this.account.display_name;
}
}
......@@ -109,6 +109,9 @@ public errordomain Accounts.ConfigError {
public class Accounts.Manager : GLib.Object {
/** The name of the Geary configuration file. */
public const string SETTINGS_FILENAME = "geary.ini";
private const string LOCAL_ID_PREFIX = "account_";
private const string LOCAL_ID_FORMAT = "account_%02u";
private const string GOA_ID_PREFIX = "goa_";
......@@ -312,8 +315,8 @@ public class Accounts.Manager : GLib.Object {
// if it's a local account, save the passwords now
SecretMediator? mediator = account.mediator as SecretMediator;
if (mediator != null) {
yield mediator.update_token(account, account.imap, cancellable);
yield mediator.update_token(account, account.smtp, cancellable);
yield mediator.update_token(account, account.incoming, cancellable);
yield mediator.update_token(account, account.outgoing, cancellable);
}
}
......@@ -511,7 +514,7 @@ public class Accounts.Manager : GLib.Object {
GLib.File data_dir = this.user_data_dir.get_child(id);
Geary.ConfigFile config = new Geary.ConfigFile(
config_dir.get_child(Geary.AccountInformation.SETTINGS_FILENAME)
config_dir.get_child(SETTINGS_FILENAME)
);
try {
......@@ -537,6 +540,15 @@ public class Accounts.Manager : GLib.Object {
string? goa_id = metadata_config.get_string(METADATA_GOA, null);
bool is_goa = (goa_id != null);
// This exists purely for people were running master with GOA
// accounts before the new accounts editor landed and 0.13 was
// released. It can be removed once 0.14 is out.
if (goa_id == null && id.has_prefix(GOA_ID_PREFIX)) {
goa_id = to_goa_id(id);
is_goa = true;
}
GoaMediator? goa_mediator = null;
Geary.ServiceProvider? default_provider = null;
Geary.CredentialsMediator mediator = this.libsecret;
......@@ -608,8 +620,11 @@ public class Accounts.Manager : GLib.Object {
if (!is_goa) {
try {
services.load(config, account, account.imap);
services.load(config, account, account.smtp);
services.load(config, account, account.incoming);
services.load(config, account, account.outgoing);
debug("IMAP host name: %s", account.incoming.host);
} catch (GLib.KeyFileError err) {
throw new ConfigError.SYNTAX(err.message);
}
......@@ -635,14 +650,15 @@ public class Accounts.Manager : GLib.Object {
private async void save_account_locked(Geary.AccountInformation account,
GLib.Cancellable? cancellable)
throws GLib.Error {
File? file = account.settings_file;
if (file == null) {
if (account.config_dir == null) {
throw new GLib.IOError.NOT_SUPPORTED(
"Account %s does not have a settings file", account.id
"Account %s does not have a config directory", account.id
);
}
Geary.ConfigFile config = new Geary.ConfigFile(file);
Geary.ConfigFile config = new Geary.ConfigFile(
account.config_dir.get_child(SETTINGS_FILENAME)
);
// Load the file first so we maintain old settings
try {
......@@ -671,11 +687,11 @@ public class Accounts.Manager : GLib.Object {
if (!is_goa) {
ServiceConfig services = new ServiceConfigV1();
services.save(account, account.imap, config);
services.save(account, account.smtp, config);
services.save(account, account.incoming, config);
services.save(account, account.outgoing, config);
}
debug("Writing config to: %s", file.get_path());
debug("Writing config to: %s", config.file.get_path());
yield config.save(cancellable);
}
......@@ -688,13 +704,13 @@ public class Accounts.Manager : GLib.Object {
SecretMediator? mediator = info.mediator as SecretMediator;
if (mediator != null) {
try {
yield mediator.clear_token(info, info.imap, cancellable);
yield mediator.clear_token(info, info.incoming, cancellable);
} catch (Error e) {
debug("Error clearing IMAP password: %s", e.message);
}
try {
yield mediator.clear_token(info, info.smtp, cancellable);
yield mediator.clear_token(info, info.outgoing, cancellable);
} catch (Error e) {
debug("Error clearing IMAP password: %s", e.message);
}
......@@ -801,7 +817,7 @@ public class Accounts.Manager : GLib.Object {
info.ordinal = Geary.AccountInformation.next_ordinal++;
info.service_label = mediator.get_service_label();
info.nickname = account.get_account().presentation_identity;
info.label = account.get_account().presentation_identity;
try {