summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/remotes_controller.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-31 22:20:28 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit2db463681564e8db945cd6811fc633545ee9fd83 (patch)
tree40edb17e174fcd8c20429ba8a7559ccc716fcd22 /pkg/gui/controllers/remotes_controller.go
parent2a1e3faa0c61cc8c2418310089485dbab268228f (diff)
no more indirection
Diffstat (limited to 'pkg/gui/controllers/remotes_controller.go')
-rw-r--r--pkg/gui/controllers/remotes_controller.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/pkg/gui/controllers/remotes_controller.go b/pkg/gui/controllers/remotes_controller.go
index bc91f40e7..d9812d213 100644
--- a/pkg/gui/controllers/remotes_controller.go
+++ b/pkg/gui/controllers/remotes_controller.go
@@ -11,30 +11,30 @@ import (
)
type RemotesController struct {
- c *types.ControllerCommon
- getContext func() types.IListContext
- git *commands.GitCommand
+ c *types.ControllerCommon
+ context types.IListContext
+ git *commands.GitCommand
getSelectedRemote func() *models.Remote
setRemoteBranches func([]*models.RemoteBranch)
- getContexts func() context.ContextTree
+ contexts *context.ContextTree
}
var _ types.IController = &RemotesController{}
func NewRemotesController(
c *types.ControllerCommon,
- getContext func() types.IListContext,
+ context types.IListContext,
git *commands.GitCommand,
- getContexts func() context.ContextTree,
+ contexts *context.ContextTree,
getSelectedRemote func() *models.Remote,
setRemoteBranches func([]*models.RemoteBranch),
) *RemotesController {
return &RemotesController{
c: c,
git: git,
- getContexts: getContexts,
- getContext: getContext,
+ contexts: contexts,
+ context: context,
getSelectedRemote: getSelectedRemote,
setRemoteBranches: setRemoteBranches,
}
@@ -48,7 +48,7 @@ func (self *RemotesController) Keybindings(getKey func(key string) interface{},
},
{
Key: gocui.MouseLeft,
- Handler: func() error { return self.getContext().HandleClick(self.checkSelected(self.enter)) },
+ Handler: func() error { return self.context.HandleClick(self.checkSelected(self.enter)) },
},
{
Key: getKey(config.Branches.FetchRemote),
@@ -72,7 +72,7 @@ func (self *RemotesController) Keybindings(getKey func(key string) interface{},
},
}
- return append(bindings, self.getContext().Keybindings(getKey, config, guards)...)
+ return append(bindings, self.context.Keybindings(getKey, config, guards)...)
}
func (self *RemotesController) enter(remote *models.Remote) error {
@@ -83,9 +83,9 @@ func (self *RemotesController) enter(remote *models.Remote) error {
if len(remote.Branches) == 0 {
newSelectedLine = -1
}
- self.getContexts().RemoteBranches.GetPanelState().SetSelectedLineIdx(newSelectedLine)
+ self.contexts.RemoteBranches.GetPanelState().SetSelectedLineIdx(newSelectedLine)
- return self.c.PushContext(self.getContexts().RemoteBranches)
+ return self.c.PushContext(self.contexts.RemoteBranches)
}
func (self *RemotesController) add() error {
@@ -191,5 +191,5 @@ func (self *RemotesController) checkSelected(callback func(*models.Remote) error
}
func (self *RemotesController) Context() types.Context {
- return self.getContext()
+ return self.context
}