diff options
author | Reto Brunner <reto@labrat.space> | 2020-08-08 11:38:38 +0200 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2020-08-10 08:00:34 +0200 |
commit | 2d7a8707257eec2b9f0ff41772cfd8dab4f1201e (patch) | |
tree | 257436ae151d923cf80aec0382f16b9fa03bbdae /widgets/account.go | |
parent | c3c982c3ec0f9702047e0e09d667bbd70a33103c (diff) | |
download | aerc-2d7a8707257eec2b9f0ff41772cfd8dab4f1201e.tar.gz |
show error if account view creation fails
This can happen for example if aerc is compiled without notmuch support but the
notmuch worker is requested.
Pushing a status message isn't good enough, as this gets overridden pretty
quickly if one has multiple accounts configured.
So we show a fullscreen error instead.
Diffstat (limited to 'widgets/account.go')
-rw-r--r-- | widgets/account.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/widgets/account.go b/widgets/account.go index 53c65ba5..bb29ce06 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -32,14 +32,18 @@ type AccountView struct { } func (acct *AccountView) UiConfig() config.UIConfig { + var folder string + if dirlist := acct.Directories(); dirlist != nil { + folder = dirlist.Selected() + } return acct.conf.GetUiConfig(map[config.ContextType]string{ config.UI_CONTEXT_ACCOUNT: acct.AccountConfig().Name, - config.UI_CONTEXT_FOLDER: acct.Directories().Selected(), + config.UI_CONTEXT_FOLDER: folder, }) } func NewAccountView(aerc *Aerc, conf *config.AercConfig, acct *config.AccountConfig, - logger *log.Logger, host TabHost) *AccountView { + logger *log.Logger, host TabHost) (*AccountView, error) { acctUiConf := conf.GetUiConfig(map[config.ContextType]string{ config.UI_CONTEXT_ACCOUNT: acct.Name, @@ -65,7 +69,8 @@ func NewAccountView(aerc *Aerc, conf *config.AercConfig, acct *config.AccountCon worker, err := worker.NewWorker(acct.Source, logger) if err != nil { host.SetError(fmt.Sprintf("%s: %s", acct.Name, err)) - return view + logger.Printf("%s: %s\n", acct.Name, err) + return view, err } view.worker = worker @@ -83,7 +88,7 @@ func NewAccountView(aerc *Aerc, conf *config.AercConfig, acct *config.AccountCon worker.PostAction(&types.Connect{}, view.connected) host.SetStatus("Connecting...") - return view + return view, nil } func (acct *AccountView) Tick() bool { |