diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-12-29 11:50:20 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-04 09:07:15 +1100 |
commit | 01ea5813a8e3b8e914332002e744e3328f55f6cd (patch) | |
tree | 5684bcf7f081c5230518394ddc732316e36674e7 /pkg/gui/gui.go | |
parent | 03b946cc8f9e94fe3fd53ac619ace2af2662aac2 (diff) |
align Gui struct with GitCommand
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 259bfb411..243af8b84 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -120,6 +120,8 @@ type Gui struct { suggestionsAsyncHandler *tasks.AsyncHandler PopupHandler PopupHandler + + IsNewRepo bool } type listPanelState struct { @@ -371,7 +373,7 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) { } } - showTree := gui.Config.GetUserConfig().Gui.ShowFileTree + showTree := gui.UserConfig.Gui.ShowFileTree contexts := gui.contextTree() @@ -455,7 +457,7 @@ func NewGui(cmn *common.Common, gitCommand *commands.GitCommand, oSCommand *osco gui.OnRunCommand = onRunCommand gui.PopupHandler = &RealPopupHandler{gui: gui} - authors.SetCustomAuthors(gui.Config.GetUserConfig().Gui.AuthorColors) + authors.SetCustomAuthors(gui.UserConfig.Gui.AuthorColors) return gui, nil } @@ -505,7 +507,7 @@ func (gui *Gui) Run() error { if err := gui.Config.ReloadUserConfig(); err != nil { return nil } - userConfig := gui.Config.GetUserConfig() + userConfig := gui.UserConfig g.SearchEscapeKey = gui.getKey(userConfig.Keybinding.Universal.Return) g.NextSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.NextMatch) g.PrevSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.PrevMatch) @@ -521,7 +523,7 @@ func (gui *Gui) Run() error { } gui.waitForIntro.Add(1) - if gui.Config.GetUserConfig().Git.AutoFetch { + if gui.UserConfig.Git.AutoFetch { go utils.Safe(gui.startBackgroundFetch) } @@ -707,8 +709,8 @@ func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function fun func (gui *Gui) startBackgroundFetch() { gui.waitForIntro.Wait() - isNew := gui.Config.GetIsNewRepo() - userConfig := gui.Config.GetUserConfig() + isNew := gui.IsNewRepo + userConfig := gui.UserConfig if !isNew { time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second) } @@ -729,7 +731,7 @@ func (gui *Gui) startBackgroundFetch() { // setColorScheme sets the color scheme for the app based on the user config func (gui *Gui) setColorScheme() error { - userConfig := gui.Config.GetUserConfig() + userConfig := gui.UserConfig theme.UpdateTheme(userConfig.Gui.Theme) gui.g.FgColor = theme.InactiveBorderColor |