summary refs log tree commit diff stats
path: root/widgets/aerc.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-10 21:15:24 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-10 21:15:24 -0400
commitb60999c39e11bf4d1e236f2b10a2f895b44d23fb (patch)
tree8ce8023277815a7d1f25dc7c48fa910c698d5b1b /widgets/aerc.go
parent62862d8a9e7f684bc3ff4e9ea115678ff44d8644 (diff)
downloadaerc-b60999c39e11bf4d1e236f2b10a2f895b44d23fb.tar.gz
Start building out command subsystem
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 26dc5f2..bf545f9 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -1,7 +1,6 @@
 package widgets
 
 import (
-	"fmt"
 	"log"
 
 	"github.com/gdamore/tcell"
@@ -13,11 +12,14 @@ import (
 
 type Aerc struct {
 	accounts map[string]*AccountView
+	cmd      func(cmd string) error
 	grid     *libui.Grid
 	tabs     *libui.Tabs
 }
 
-func NewAerc(conf *config.AercConfig, logger *log.Logger) *Aerc {
+func NewAerc(conf *config.AercConfig, logger *log.Logger,
+	cmd func(cmd string) error) *Aerc {
+
 	tabs := libui.NewTabs()
 
 	mainGrid := libui.NewGrid().Rows([]libui.GridSpec{
@@ -37,12 +39,13 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger) *Aerc {
 
 	aerc := &Aerc{
 		accounts: make(map[string]*AccountView),
+		cmd:      cmd,
 		grid:     mainGrid,
 		tabs:     tabs,
 	}
 
 	for _, acct := range conf.Accounts {
-		view := NewAccountView(&acct, logger, aerc.RunCommand)
+		view := NewAccountView(&acct, logger, cmd)
 		aerc.accounts[acct.Name] = view
 		tabs.Add(view, acct.Name)
 	}
@@ -73,7 +76,6 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
 	return acct.Event(event)
 }
 
-func (aerc *Aerc) RunCommand(cmd string) error {
-	// TODO
-	return fmt.Errorf("TODO: execute '%s'", cmd)
+func (aerc *Aerc) SelectedAccount() *AccountView {
+	return aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name]
 }
mmitter James Booth <boothj5@gmail.com> 2014-10-30 23:42:08 +0000 Fixed PLATFORM check in configure.ac' href='/danisanti/profani-tty/commit/configure.ac?id=5235b1f149e57d93b5432a25f9c12e822521e220'>5235b1f1 ^
b5171cb0 ^



14edbe17 ^
c51cc954 ^










b5171cb0 ^
dcccfacb ^
82ddbf33 ^

f6ca1ba1 ^
2519e450 ^
d2035496 ^

e504c030 ^

2490c3ed ^

d2035496 ^
dcccfacb ^
3ceb9b0d ^

dcccfacb ^
2b88e2f1 ^





2519e450 ^

dcccfacb ^
2519e450 ^
dcccfacb ^
2519e450 ^
bc8a871a ^
1588106e ^
5b734156 ^
2519e450 ^
2c361644 ^

2519e450 ^

768df4d7 ^



f983438e ^
768df4d7 ^
f983438e ^
768df4d7 ^






2c976d35 ^
7fa9ecc7 ^

dcccfacb ^
0cdbfecb ^




e361ea69 ^









524b1f23 ^
2c361644 ^
b5171cb0 ^

f0ffceef ^
b5171cb0 ^











f0ffceef ^
b5171cb0 ^





dcccfacb ^

d2035496 ^

78841f2e ^
dcccfacb ^

d2035496 ^


dcccfacb ^
78841f2e ^
bd1c1394 ^
78841f2e ^
2490c3ed ^
54df2101 ^
2490c3ed ^
f8187382 ^




24ebb512 ^
54df2101 ^


2490c3ed ^

fa89e2aa ^
7e4b1b1d ^
fa89e2aa ^
1dba341d ^
50afe736 ^
fa89e2aa ^











1dba341d ^


d2035496 ^

3ceb9b0d ^








2519e450 ^

dcccfacb ^

28f5cdf7 ^
252c7c2e ^

c5a04de9 ^



2c5b4442 ^
2519e450 ^
d28930ea ^
8e0d8d2a ^
11066f20 ^
2519e450 ^
4cb302ab ^
dcccfacb ^

575b6acd ^
aa6e2284 ^
2c361644 ^
3c062438 ^



2519e450 ^
8014e902 ^
2655d9e8 ^


dcccfacb ^

b5171cb0 ^
dcccfacb ^



3cae0208 ^
3ceb9b0d ^

dcccfacb ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234