diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-01-13 13:25:56 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-01-13 13:25:56 -0500 |
commit | b76deea9635d56bfa740127683e43bf817f5e3be (patch) | |
tree | 1f441196e2a1bb96a7fabbad2d19472c5d4d2905 /widgets/aerc.go | |
parent | 0fee2d6f971b59844830d7b27719322661de8d15 (diff) | |
download | aerc-b76deea9635d56bfa740127683e43bf817f5e3be.tar.gz |
Move status line into account, update behavior
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r-- | widgets/aerc.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go index 4351f3b..58e8972 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -12,6 +12,7 @@ import ( ) type Aerc struct { + accounts map[string]*AccountView grid *libui.Grid tabs *libui.Tabs statusbar *libui.Stack @@ -41,16 +42,16 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger) *Aerc { mainGrid.AddChild(tabs.TabStrip).At(0, 1) mainGrid.AddChild(tabs.TabContent).At(1, 0).Span(1, 2) + accts := make(map[string]*AccountView) + for _, acct := range conf.Accounts { - view, err := NewAccountView(&acct, logger, statusbar) - if err != nil { - // TODO: something useful (update statusline?) - panic(err) - } + view := NewAccountView(&acct, logger, statusbar) + accts[acct.Name] = view tabs.Add(view, acct.Name) } return &Aerc{ + accounts: accts, grid: mainGrid, statusbar: statusbar, statusline: statusline, @@ -59,7 +60,9 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger) *Aerc { } func (aerc *Aerc) OnInvalidate(onInvalidate func(d libui.Drawable)) { - aerc.grid.OnInvalidate(onInvalidate) + aerc.grid.OnInvalidate(func(_ libui.Drawable) { + onInvalidate(aerc) + }) } func (aerc *Aerc) Invalidate() { |