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:
@@ -11,7 +11,8 @@ const (
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
wrapText bool
|
||||
apiUrl string
|
||||
token string
|
||||
@@ -24,7 +25,8 @@ type Settings struct {
|
||||
|
||||
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),
|
||||
|
||||
apiUrl: ymlConfig.UString("apiUrl"),
|
||||
token: ymlConfig.UString("token"),
|
||||
showSummary: ymlConfig.UBool("showSummary", true),
|
||||
|
||||
@@ -18,11 +18,11 @@ type Widget struct {
|
||||
//func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.settings.common.RefreshInterval = 30
|
||||
widget.settings.RefreshInterval = 30
|
||||
widget.initializeKeyboardControls()
|
||||
widget.SetDisplayFunction(widget.Refresh)
|
||||
widget.View.SetWordWrap(true)
|
||||
|
||||
Reference in New Issue
Block a user