1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-06-28 05:25:11 +00:00

Improvements to progress dialogs

This commit is contained in:
2023-05-27 17:52:51 +02:00
parent 167c3bddb6
commit ab1891be27
3 changed files with 25 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/ncruces/zenity"
)
// @todo: this takes ~0.5 seconds. Improve?
func (u *UI) StartProgressBar(id uint, title string) {
if title == "" {
// default title
@ -20,13 +21,13 @@ func (u *UI) StartProgressBar(id uint, title string) {
func (u *UI) StopProgressBar(id uint) {
for try := 0; try < 10; try++ {
p := u.progressBars[id]
if p != nil {
if p := u.progressBars[id]; p != nil {
p.Complete()
p.Close()
p = nil
return
}
println("Progress dialog not found:", id, try)
time.Sleep(100 * time.Millisecond)
}