about summary refs log tree commit diff stats
path: root/widgets/account.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-01-24 18:18:49 +0100
committerDrew DeVault <sir@cmpwn.com>2020-01-24 12:25:59 -0500
commite78b7b85e4792f413175e13ef2fe437839b017a2 (patch)
tree0e050469f2f3d7768d4cc8f39af27a580d03e7b1 /widgets/account.go
parentdf5d9a3ec7564f0d95e3f92afc0e59588de3c4ce (diff)
downloadaerc-e78b7b85e4792f413175e13ef2fe437839b017a2.tar.gz
config: Strongly type context type
The go compiler can't help much with untyped int constants.
Even though the only valid constants are 0-3 it will happily accept 4 as input.

Let's let the go compiler worry about correctness here. This also allows people
not very familiar with the code to use it properly via auto completion.
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go4
1 files changed, 2 insertions, 2 deletions
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,
 	})