mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-31 10:19:27 +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
|
||
|
}
|