diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-01-26 10:16:43 -0600 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-01-29 21:47:11 +0100 |
commit | 6b39c0dae1e1c42445a2d8557e48135b02fc729b (patch) | |
tree | d65d2898424178203c0be52c56c255f96f8d51ee /widgets/dirlist.go | |
parent | db60d7edeceaec075f91a802968c397698798d50 (diff) | |
download | aerc-6b39c0dae1e1c42445a2d8557e48135b02fc729b.tar.gz |
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 <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/dirlist.go')
-rw-r--r-- | widgets/dirlist.go | 14 |
1 files changed, 14 insertions, 0 deletions
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)) |