summary refs log tree commit diff stats
path: root/widgets/aerc.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-14 08:14:03 -0500
committerDrew DeVault <sir@cmpwn.com>2019-01-14 08:14:03 -0500
commit8492a21a51c107f743a32231746bf5d38e9b1ccd (patch)
treeb0ed6d96dbc664c57bb9a0d1488ab4fec2e12f37 /widgets/aerc.go
parentd35213eaabeda8749cd0aab103e5895cfcd96e94 (diff)
downloadaerc-8492a21a51c107f743a32231746bf5d38e9b1ccd.tar.gz
Send commands up to the top-level aerc widget
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index cd4b773..9444c9f 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -1,6 +1,7 @@
 package widgets
 
 import (
+	"fmt"
 	"log"
 
 	"github.com/gdamore/tcell"
@@ -33,19 +34,19 @@ 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)
+	aerc := &Aerc{
+		accounts: make(map[string]*AccountView),
+		grid:     mainGrid,
+		tabs:     tabs,
+	}
 
 	for _, acct := range conf.Accounts {
-		view := NewAccountView(&acct, logger)
-		accts[acct.Name] = view
+		view := NewAccountView(&acct, logger, aerc.RunCommand)
+		aerc.accounts[acct.Name] = view
 		tabs.Add(view, acct.Name)
 	}
 
-	return &Aerc{
-		accounts: accts,
-		grid:     mainGrid,
-		tabs:     tabs,
-	}
+	return aerc
 }
 
 func (aerc *Aerc) OnInvalidate(onInvalidate func(d libui.Drawable)) {
@@ -66,3 +67,8 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
 	acct, _ := aerc.tabs.Tabs[aerc.tabs.Selected].Content.(*AccountView)
 	return acct.Event(event)
 }
+
+func (aerc *Aerc) RunCommand(cmd string) error {
+	// TODO
+	return fmt.Errorf("TODO: execute '%s'", cmd)
+}