Ensure AccountInformation objects always have valid IMAP/SMTP services.

* src/engine/api/geary-engine.vala (Engine): Require a ServiceInformation
  object for IMAP and SMTP when creating orphan info objects. Update call
  sites.

* src/client/accounts/account-manager.vala (AccountManager): provide
  factory methods for constructing local service info objects. Use these
  when re-constituting accounts. Use a singleton SecretMediator object
  instance as a bonus.

* src/client/accounts/add-edit-page.vala (AddEditPage): Get
  ServiceInformation objects from the account manager, pass an instance
  of GearyApplication through so it has access to the manager. Update
  call chains back to GearyController to pass the app instance through.
This commit is contained in:
Michael James Gratton 2018-05-24 16:51:16 +10:00
parent 91e85a6647
commit 4fdeb9db47
8 changed files with 117 additions and 69 deletions

View file

@ -208,7 +208,9 @@ public class Geary.Engine : BaseObject {
* Throws an error if the engine has not been opened or if an
* invalid account id is generated.
*/
public AccountInformation create_orphan_account() throws Error {
public AccountInformation create_orphan_account(ServiceInformation imap,
ServiceInformation smtp)
throws GLib.Error {
check_opened();
// We might want to allow the client to specify the id, but
@ -233,7 +235,7 @@ public class Geary.Engine : BaseObject {
if (this.accounts.has_key(id))
throw new EngineError.ALREADY_EXISTS("Account %s already exists", id);
return new AccountInformation(id, null, null);
return new AccountInformation(id, imap, smtp);
}
/**