mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-31 02:09:28 +00:00
29 lines
492 B
Go
29 lines
492 B
Go
package ui
|
|
|
|
import "github.com/ncruces/zenity"
|
|
|
|
func (u *UI) StartProgressBar(title string) {
|
|
if u.progress != nil {
|
|
// already loading
|
|
return
|
|
}
|
|
if title == "" {
|
|
// default title
|
|
title = "Loading"
|
|
}
|
|
p, err := zenity.Progress(zenity.Title(title), zenity.Pulsate(), zenity.NoCancel(), zenity.Modal())
|
|
if err != nil {
|
|
return
|
|
}
|
|
u.progress = p
|
|
}
|
|
|
|
func (u *UI) StopProgressBar() {
|
|
if u.progress == nil {
|
|
return
|
|
}
|
|
u.progress.Complete()
|
|
u.progress.Close()
|
|
u.progress = nil
|
|
}
|