diff options
author | Reto Brunner <reto@labrat.space> | 2020-07-30 23:22:32 +0200 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2020-07-30 23:22:32 +0200 |
commit | 3d784c5d8c7d037e38159fc1753773a2e81aa43e (patch) | |
tree | 2c062c9f4b4641a59e3f4f3ff3317f636bfd49cf /config/config.go | |
parent | 6ee7b1c3fd40b0e2f93dcaa7ffb3b0bdd56ac285 (diff) | |
download | aerc-3d784c5d8c7d037e38159fc1753773a2e81aa43e.tar.gz |
Revert "Implement style configuration."
This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 55 |
1 files changed, 6 insertions, 49 deletions
diff --git a/config/config.go b/config/config.go index 9e78c86c..00a52ce7 100644 --- a/config/config.go +++ b/config/config.go @@ -45,9 +45,6 @@ type UIConfig struct { NextMessageOnDelete bool `ini:"next-message-on-delete"` CompletionDelay time.Duration `ini:"completion-delay"` CompletionPopovers bool `ini:"completion-popovers"` - StyleSetDirs []string `ini:"stylesets-dirs" delim:":"` - StyleSetName string `ini:"styleset-name"` - style StyleSet } type ContextType int @@ -414,19 +411,6 @@ func (config *AercConfig) LoadConfig(file *ini.File) error { } } } - - if err := config.Ui.loadStyleSet( - config.Ui.StyleSetDirs); err != nil { - return err - } - - for idx, _ := range config.ContextualUis { - if err := config.ContextualUis[idx].UiConfig.loadStyleSet( - config.Ui.StyleSetDirs); err != nil { - return err - } - } - return nil } @@ -487,8 +471,6 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) { NextMessageOnDelete: true, CompletionDelay: 250 * time.Millisecond, CompletionPopovers: true, - StyleSetDirs: []string{path.Join(sharedir, "stylesets")}, - StyleSetName: "default", }, ContextualUis: []UIConfigContext{}, @@ -518,7 +500,6 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) { Forwards: "forward_as_body", }, } - // These bindings are not configurable config.Bindings.AccountWizard.ExKey = KeyStroke{ Key: tcell.KeyCtrlE, @@ -529,7 +510,6 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) { if err = config.LoadConfig(file); err != nil { return nil, err } - if ui, err := file.GetSection("general"); err == nil { if err := ui.MapTo(&config.General); err != nil { return nil, err @@ -637,18 +617,8 @@ func parseLayout(layout string) [][]string { return l } -func (ui *UIConfig) loadStyleSet(styleSetDirs []string) error { - ui.style = NewStyleSet() - err := ui.style.LoadStyleSet(ui.StyleSetName, styleSetDirs) - if err != nil { - return fmt.Errorf("Unable to load default styleset: %s", err) - } - - return nil -} - -func (config AercConfig) mergeContextualUi(baseUi UIConfig, - contextType ContextType, s string) UIConfig { +func (config *AercConfig) mergeContextualUi(baseUi *UIConfig, + contextType ContextType, s string) { for _, contextualUi := range config.ContextualUis { if contextualUi.ContextType != contextType { continue @@ -658,30 +628,17 @@ func (config AercConfig) mergeContextualUi(baseUi UIConfig, continue } - mergo.Merge(&baseUi, contextualUi.UiConfig, mergo.WithOverride) - if contextualUi.UiConfig.StyleSetName != "" { - baseUi.style = contextualUi.UiConfig.style - } - return baseUi + mergo.MergeWithOverwrite(baseUi, contextualUi.UiConfig) + return } - - return baseUi } -func (config AercConfig) GetUiConfig(params map[ContextType]string) UIConfig { +func (config *AercConfig) GetUiConfig(params map[ContextType]string) UIConfig { baseUi := config.Ui for k, v := range params { - baseUi = config.mergeContextualUi(baseUi, k, v) + config.mergeContextualUi(&baseUi, k, v) } return baseUi } - -func (uiConfig UIConfig) GetStyle(so StyleObject) tcell.Style { - return uiConfig.style.Get(so) -} - -func (uiConfig UIConfig) GetStyleSelected(so StyleObject) tcell.Style { - return uiConfig.style.Selected(so) -} |