diff options
author | mjarkk <mkopenga@gmail.com> | 2018-11-10 09:27:03 +0100 |
---|---|---|
committer | mjarkk <mkopenga@gmail.com> | 2018-11-10 09:27:03 +0100 |
commit | 8742c4c11077755823b64982d0135e906ea71277 (patch) | |
tree | e1e849c0c6f386db1f6d07647b1edf41df2a5cb2 /pkg | |
parent | 32ecc6d7452d831e18caf4da481a34b6f6c130a8 (diff) |
Removed some variables and placed them inside the gui struct
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/commit_message_panel.go | 32 | ||||
-rw-r--r-- | pkg/gui/gui.go | 1 |
2 files changed, 18 insertions, 15 deletions
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index d2b1de0fb..1b2659593 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -52,14 +52,16 @@ func (gui *Gui) handleCommitFocused(g *gocui.Gui, v *gocui.View) error { return gui.renderString(g, "options", message) } -var unamePassMessage = "" -var waitForGroup sync.WaitGroup -var waitForGroupActie = false +type credentials struct { + unamePassMessage string + waitForGroup sync.WaitGroup + waitForGroupActie bool +} // waitForPassUname wait for a username or password input from the pushPassUname popup func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUname string) string { - waitForGroupActie = true - waitForGroup.Add(1) + gui.credentials.waitForGroupActie = true + gui.credentials.waitForGroup.Add(1) pushPassUnameView, _ := g.View("pushPassUname") if passOrUname == "username" { @@ -83,8 +85,8 @@ func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUn }) // wait for username/passwords input - waitForGroup.Wait() - return unamePassMessage + gui.credentials.waitForGroup.Wait() + return gui.credentials.unamePassMessage } func (gui *Gui) handlePushConfirm(g *gocui.Gui, v *gocui.View) error { @@ -94,10 +96,10 @@ func (gui *Gui) handlePushConfirm(g *gocui.Gui, v *gocui.View) error { // if not dune the push progress will run forever message = "-" } - unamePassMessage = message - if waitForGroupActie { - waitForGroup.Done() - waitForGroupActie = false + gui.credentials.unamePassMessage = message + if gui.credentials.waitForGroupActie { + gui.credentials.waitForGroup.Done() + gui.credentials.waitForGroupActie = false } err := gui.refreshFiles(g) if err != nil { @@ -124,10 +126,10 @@ func (gui *Gui) handlePushClose(g *gocui.Gui, v *gocui.View) error { if err != nil { return err } - unamePassMessage = "" - if waitForGroupActie { - waitForGroup.Done() - waitForGroupActie = false + gui.credentials.unamePassMessage = "" + if gui.credentials.waitForGroupActie { + gui.credentials.waitForGroup.Done() + gui.credentials.waitForGroupActie = false } return gui.switchFocus(g, v, gui.getFilesView(g)) } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index b67ed7b34..60d22f4e9 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -70,6 +70,7 @@ type Gui struct { Errors SentinelErrors Updater *updates.Updater statusManager *statusManager + credentials credentials } type guiState struct { |