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:
@@ -17,12 +17,12 @@ type colors struct {
|
||||
|
||||
type Settings struct {
|
||||
colors
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
}
|
||||
|
||||
settings.colors.label = ymlConfig.UString("colors.label", "green")
|
||||
|
||||
@@ -21,7 +21,7 @@ type Widget struct {
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
|
||||
Info: spotigopher.Info{},
|
||||
client: spotigopher.NewClient(),
|
||||
@@ -29,7 +29,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.settings.common.RefreshInterval = 5
|
||||
widget.settings.RefreshInterval = 5
|
||||
|
||||
widget.initializeKeyboardControls()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user