mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Constantize the defaultFocus value for each module
This commit is contained in:
@@ -5,6 +5,11 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = true
|
||||
defaultTitle = "Transmission"
|
||||
)
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
@@ -17,14 +22,10 @@ type Settings struct {
|
||||
username string `help:"The username of the Transmission user"`
|
||||
}
|
||||
|
||||
const (
|
||||
defaultTitle = "Transmission"
|
||||
)
|
||||
|
||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
host: ymlConfig.UString("host"),
|
||||
https: ymlConfig.UBool("https", false),
|
||||
|
||||
@@ -23,7 +23,7 @@ type Widget struct {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
|
||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user