From 6b39c0dae1e1c42445a2d8557e48135b02fc729b Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Thu, 26 Jan 2023 10:16:43 -0600 Subject: tabs: use template for account tab name Use a go template to render the account tab display. Add config option for setting a specific template for the account. Add a method on Tab to allow setting a title, which may be different than the tab Name. The default template is {{.Account}}. Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- widgets/dirlist.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'widgets/dirlist.go') diff --git a/widgets/dirlist.go b/widgets/dirlist.go index 09a1155a..8e6fa751 100644 --- a/widgets/dirlist.go +++ b/widgets/dirlist.go @@ -42,6 +42,7 @@ type DirectoryLister interface { SetMsgStore(string, *lib.MessageStore) FilterDirs([]string, []string, bool) []string + GetRUECount(string) (int, int, int) UiConfig(string) *config.UIConfig } @@ -254,6 +255,19 @@ func (dirlist *DirectoryList) getRUEString(name string) string { return rueString } +// Returns the Recent, Unread, and Exist counts for the named directory +func (dirlist *DirectoryList) GetRUECount(name string) (int, int, int) { + msgStore, ok := dirlist.MsgStore(name) + if !ok { + return 0, 0, 0 + } + if !msgStore.DirInfo.AccurateCounts { + msgStore.DirInfo.Recent, msgStore.DirInfo.Unseen = countRUE(msgStore) + } + di := msgStore.DirInfo + return di.Recent, di.Unseen, di.Exists +} + func (dirlist *DirectoryList) Draw(ctx *ui.Context) { ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', dirlist.UiConfig("").GetStyle(config.STYLE_DIRLIST_DEFAULT)) -- cgit