blob: cec6f8b6adab3a4180452d85325000348611ec33 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package gui
import (
"github.com/isacikgoz/gitbatch/pkg/git"
"github.com/jroimartin/gocui"
log "github.com/sirupsen/logrus"
)
// this function starts the queue and updates the gui with the result of an
// operation
func (gui *Gui) startQueue(g *gocui.Gui, v *gocui.View) error {
go func(gui_go *Gui, g_go *gocui.Gui) {
for {
job, finished, err := gui_go.State.Queue.StartNext()
g_go.Update(func(gu *gocui.Gui) error {
gui_go.refreshMain(gu)
return nil
})
defer gui.updateKeyBindingsView(g, mainViewFeature.Name)
if err != nil {
if err == git.ErrAuthenticationRequired {
err := gui_go.openAuthenticationView(g, gui_go.State.Queue, job, v.Name())
if err != nil {
log.Warn(err.Error())
return
}
}
return
}
if finished {
return
}
selectedEntity := gui_go.getSelectedRepository()
if job.Entity == selectedEntity {
gui_go.refreshViews(g, job.Entity)
}
}
}(gui, g)
return nil
}
// flashes the keybinding view's backgroun with green color to indicate that
// the queue is started
func indicateQueueStarted(g *gocui.Gui) error {
v, err := g.View(keybindingsViewFeature.Name)
if err != nil {
return err
}
v.BgColor = gocui.ColorGreen
v.FgColor = gocui.ColorBlack
return nil
}
|