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

@@ -11,7 +11,8 @@ const (
)
type Settings struct {
common *cfg.Common
*cfg.Common
consumerKey string
requestKey *string
accessToken *string
@@ -19,7 +20,7 @@ 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),
consumerKey: ymlConfig.UString("consumerKey"),
}

View File

@@ -23,7 +23,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
ScrollableWidget: view.NewScrollableWidget(app, nil, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, nil, settings.Common),
settings: settings,
client: NewClient(settings.consumerKey, "http://localhost"),
archivedView: false,
@@ -199,11 +199,11 @@ func (widget *Widget) toggleLink() {
}
func (widget *Widget) formatItem(item Item, isSelected bool) string {
foreColor, backColor := widget.settings.common.Colors.RowTheme.EvenForeground, widget.settings.common.Colors.RowTheme.EvenBackground
foreColor, backColor := widget.settings.Colors.RowTheme.EvenForeground, widget.settings.Colors.RowTheme.EvenBackground
text := item.ResolvedTitle
if isSelected {
foreColor = widget.settings.common.Colors.RowTheme.HighlightedForeground
backColor = widget.settings.common.Colors.RowTheme.HighlightedBackground
foreColor = widget.settings.Colors.RowTheme.HighlightedForeground
backColor = widget.settings.Colors.RowTheme.HighlightedBackground
}