about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config/config.go11
-rw-r--r--widgets/account.go4
-rw-r--r--widgets/msglist.go2
3 files changed, 10 insertions, 7 deletions
diff --git a/config/config.go b/config/config.go
index 0b46014..0393e46 100644
--- a/config/config.go
+++ b/config/config.go
@@ -46,14 +46,16 @@ type UIConfig struct {
 	CompletionPopovers  bool          `ini:"completion-popovers"`
 }
 
+type ContextType int
+
 const (
-	UI_CONTEXT_FOLDER = iota
+	UI_CONTEXT_FOLDER ContextType = iota
 	UI_CONTEXT_ACCOUNT
 	UI_CONTEXT_SUBJECT
 )
 
 type UIConfigContext struct {
-	ContextType int
+	ContextType ContextType
 	Regex       *regexp.Regexp
 	UiConfig    UIConfig
 }
@@ -602,7 +604,8 @@ func parseLayout(layout string) [][]string {
 	return l
 }
 
-func (config *AercConfig) mergeContextualUi(baseUi *UIConfig, contextType int, s string) {
+func (config *AercConfig) mergeContextualUi(baseUi *UIConfig,
+	contextType ContextType, s string) {
 	for _, contextualUi := range config.ContextualUis {
 		if contextualUi.ContextType != contextType {
 			continue
@@ -617,7 +620,7 @@ func (config *AercConfig) mergeContextualUi(baseUi *UIConfig, contextType int, s
 	}
 }
 
-func (config *AercConfig) GetUiConfig(params map[int]string) UIConfig {
+func (config *AercConfig) GetUiConfig(params map[ContextType]string) UIConfig {
 	baseUi := config.Ui
 
 	for k, v := range params {
diff --git a/widgets/account.go b/widgets/account.go
index 66320a3..455c28e 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -32,7 +32,7 @@ type AccountView struct {
 }
 
 func (acct *AccountView) UiConfig() config.UIConfig {
-	return acct.conf.GetUiConfig(map[int]string{
+	return acct.conf.GetUiConfig(map[config.ContextType]string{
 		config.UI_CONTEXT_ACCOUNT: acct.AccountConfig().Name,
 		config.UI_CONTEXT_FOLDER:  acct.Directories().Selected(),
 	})
@@ -41,7 +41,7 @@ func (acct *AccountView) UiConfig() config.UIConfig {
 func NewAccountView(aerc *Aerc, conf *config.AercConfig, acct *config.AccountConfig,
 	logger *log.Logger, host TabHost) *AccountView {
 
-	acctUiConf := conf.GetUiConfig(map[int]string{
+	acctUiConf := conf.GetUiConfig(map[config.ContextType]string{
 		config.UI_CONTEXT_ACCOUNT: acct.Name,
 	})
 
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 24a9940..9aff0d4 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -106,7 +106,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
 		}
 
 		ctx.Fill(0, row, ctx.Width(), 1, ' ', style)
-		uiConfig := ml.conf.GetUiConfig(map[int]string{
+		uiConfig := ml.conf.GetUiConfig(map[config.ContextType]string{
 			config.UI_CONTEXT_ACCOUNT: ml.aerc.SelectedAccount().AccountConfig().Name,
 			config.UI_CONTEXT_FOLDER:  ml.aerc.SelectedAccount().Directories().Selected(),
 			config.UI_CONTEXT_SUBJECT: msg.Envelope.Subject,
release' href='/danisanti/profani-tty/commit/theme_template?id=30b5f112fd81890411d6fe52c1f442f4433e0d01'>30b5f112 ^
216493ef ^
316b6a7b ^
16fbdedc ^
b4482b9f ^
216493ef ^

b4482b9f ^
216493ef ^

b4482b9f ^
216493ef ^
97d96746 ^

30b5f112 ^
b21edfaa ^
57dc5f14 ^
f0f3a739 ^
35239ee3 ^

fb7001cf ^
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