1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Simplify the inclusion of the Common config settings into each module

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer
2020-11-26 19:53:21 -08:00
parent f9a06540f1
commit d6a0797bf2
161 changed files with 378 additions and 330 deletions

View File

@@ -20,7 +20,7 @@ func (widget *Widget) content() (string, string, bool) {
title := fmt.Sprintf(
"[%s]%s[white]",
widget.settings.common.Colors.TextTheme.Title,
widget.settings.Colors.TextTheme.Title,
proj.Name)
str := ""

View File

@@ -13,7 +13,7 @@ const (
)
type Settings struct {
common *cfg.Common
*cfg.Common
backendType string
backendSettings *config.Config
@@ -24,7 +24,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
backend, _ := ymlConfig.Get("backendSettings")
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
backendType: ymlConfig.UString("backendType"),
backendSettings: backend,
@@ -41,7 +41,7 @@ func FromTodoist(name string, ymlConfig *config.Config, globalConfig *config.Con
_ = backend.Set(".projects", projects)
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
backendType: "todoist",
backendSettings: backend,
@@ -71,7 +71,7 @@ func FromTrello(name string, ymlConfig *config.Config, globalConfig *config.Conf
_ = backend.Set(".lists", lists)
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
backendType: "trello",
backendSettings: backend,

View File

@@ -21,8 +21,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "project", "projects"),
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "project", "projects"),
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
settings: settings,
}