From 9b19e3ad054132fdab4062915f70122faaa5c163 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 22 May 2019 11:35:55 -0400 Subject: Show account wizard if no accounts configured --- widgets/account-wizard.go | 7 ++----- widgets/aerc.go | 6 ++++++ 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'widgets') diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go index aa68ed79..6cd541e3 100644 --- a/widgets/account-wizard.go +++ b/widgets/account-wizard.go @@ -356,8 +356,8 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard { "To add another account in the future, run ':new-account'.")) selecter = newSelecter([]string{ "Previous", - "Finish", "Finish & open tutorial", + "Finish", }, 1).OnChoose(func(option string) { switch option { case "Previous": @@ -436,11 +436,8 @@ func (wizard *AccountWizard) finish(tutorial bool) { } file, err := ini.Load(accountsConf) - if err == os.ErrNotExist { + if err != nil { file = ini.Empty() - } else if err != nil { - wizard.errorFor(nil, err) - return } var sec *ini.Section diff --git a/widgets/aerc.go b/widgets/aerc.go index 484fd88e..3c6566de 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -62,6 +62,12 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger, tabs.Add(view, acct.Name) } + if len(conf.Accounts) == 0 { + wizard := NewAccountWizard(aerc.Config(), aerc) + wizard.Focus(true) + aerc.NewTab(wizard, "New account") + } + return aerc } -- cgit