2021-04-25 13:34:56 -04:00
|
|
|
package zenity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"github.com/ncruces/zenity/internal/zenutil"
|
|
|
|
)
|
|
|
|
|
|
|
|
func progress(opts options) (ProgressDialog, error) {
|
|
|
|
var env []string
|
|
|
|
if opts.title != nil {
|
|
|
|
env = append(env, "description="+*opts.title)
|
|
|
|
}
|
|
|
|
if opts.maxValue == 0 {
|
|
|
|
opts.maxValue = 100
|
|
|
|
}
|
|
|
|
if opts.maxValue >= 0 {
|
|
|
|
env = append(env, "total="+strconv.Itoa(opts.maxValue))
|
|
|
|
}
|
2021-04-25 19:36:15 -04:00
|
|
|
return zenutil.RunProgress(opts.ctx, opts.maxValue, env)
|
2021-04-25 13:34:56 -04:00
|
|
|
}
|