aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/widgets/account.go b/widgets/account.go
index c2b8b8e9..6c9ab3eb 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -1,6 +1,7 @@
package widgets
import (
+ "bytes"
"errors"
"fmt"
"sync"
@@ -30,6 +31,7 @@ type AccountView struct {
labels []string
grid *ui.Grid
host TabHost
+ tab *ui.Tab
msglist *MessageList
worker *types.Worker
state *statusline.State
@@ -351,6 +353,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
acct.PushError(msg.Error)
}
acct.UpdateStatus()
+ acct.setTitle()
}
func (acct *AccountView) updateDirCounts(destination string, uids []uint32) {
@@ -588,3 +591,29 @@ func (acct *AccountView) Vsplit(n int) error {
acct.updateSplitView(acct.msglist.Selected())
return nil
}
+
+// setTitle executes the title template and sets the tab title
+func (acct *AccountView) setTitle() {
+ data := struct {
+ Account string
+ Recent int
+ Unread int
+ Exists int
+ Folder string
+ }{}
+ data.Account = acct.Name()
+ data.Folder = acct.SelectedDirectory()
+ for _, name := range acct.dirlist.List() {
+ r, u, e := acct.dirlist.GetRUECount(name)
+ data.Recent += r
+ data.Unread += u
+ data.Exists += e
+ }
+ buf := bytes.NewBuffer(nil)
+ err := acct.uiConf.TabTitleAccount.Execute(buf, data)
+ if err != nil {
+ acct.PushError(err)
+ return
+ }
+ acct.tab.SetTitle(buf.String())
+}