2018-01-11 04:41:15 +01:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
tb "github.com/nsf/termbox-go"
|
|
|
|
|
|
|
|
"git.sr.ht/~sircmpwn/aerc2/config"
|
|
|
|
"git.sr.ht/~sircmpwn/aerc2/worker"
|
|
|
|
)
|
|
|
|
|
|
|
|
type AccountTab struct {
|
|
|
|
Config *config.AccountConfig
|
|
|
|
Worker *worker.Worker
|
|
|
|
Parent *UIState
|
2018-01-11 04:54:55 +01:00
|
|
|
|
|
|
|
counter int
|
2018-01-11 04:41:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewAccountTab(conf *config.AccountConfig, work *worker.Worker) *AccountTab {
|
|
|
|
return &AccountTab{
|
|
|
|
Config: conf,
|
|
|
|
Worker: work,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (acc *AccountTab) Name() string {
|
|
|
|
return acc.Config.Name
|
|
|
|
}
|
|
|
|
|
|
|
|
func (acc *AccountTab) SetParent(parent *UIState) {
|
|
|
|
acc.Parent = parent
|
|
|
|
}
|
|
|
|
|
|
|
|
func (acc *AccountTab) Render(at Geometry) {
|
|
|
|
cell := tb.Cell{
|
|
|
|
Fg: tb.ColorDefault,
|
|
|
|
Bg: tb.ColorDefault,
|
|
|
|
}
|
2018-01-11 04:54:55 +01:00
|
|
|
TPrintf(&at, cell, "%s %d", acc.Name(), acc.counter)
|
|
|
|
acc.counter++
|
|
|
|
if acc.counter%10000 == 0 {
|
|
|
|
acc.counter = 0
|
|
|
|
}
|
|
|
|
acc.Parent.InvalidateFrom(acc)
|
2018-01-11 04:41:15 +01:00
|
|
|
}
|