From 899d16f20f46abe6ce30e969f868cd1125ddadb9 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Wed, 7 Aug 2024 20:52:32 +0200 Subject: tabs: update ui config in any tab Update UI config in tabs. Signed-off-by: Koni Marti Tested-by: Inwit Acked-by: Robin Jarry --- app/aerc.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'app/aerc.go') diff --git a/app/aerc.go b/app/aerc.go index 38340c7d..beef6328 100644 --- a/app/aerc.go +++ b/app/aerc.go @@ -57,7 +57,13 @@ func (aerc *Aerc) Init( complete func(cmd string) ([]string, string), cmdHistory lib.History, deferLoop chan struct{}, ) { - tabs := ui.NewTabs(config.Ui) + tabs := ui.NewTabs(func(d ui.Drawable) *config.UIConfig { + acct := aerc.account(d) + if acct != nil { + return config.Ui.ForAccount(acct.Name()) + } + return config.Ui + }) statusbar := ui.NewStack(config.Ui) statusline := &StatusLine{} @@ -88,10 +94,10 @@ func (aerc *Aerc) Init( for _, acct := range config.Accounts { view, err := NewAccountView(acct, deferLoop) if err != nil { - tabs.Add(errorScreen(err.Error()), acct.Name, nil, false) + tabs.Add(errorScreen(err.Error()), acct.Name, false) } else { aerc.accounts[acct.Name] = view - view.tab = tabs.Add(view, acct.Name, view.UiConfig(), false) + view.tab = tabs.Add(view, acct.Name, false) } } @@ -504,11 +510,7 @@ func (aerc *Aerc) SelectedTab() *ui.Tab { } func (aerc *Aerc) NewTab(clickable ui.Drawable, name string, background bool) *ui.Tab { - uiConf := config.Ui - if acct := aerc.account(clickable); acct != nil { - uiConf = acct.UiConfig() - } - tab := aerc.tabs.Add(clickable, name, uiConf, background) + tab := aerc.tabs.Add(clickable, name, background) aerc.UpdateStatus() return tab } -- cgit