zenity/progress_darwin.go

23 lines
419 B
Go
Raw Permalink Normal View History

2021-04-25 13:34:56 -04:00
package zenity
import (
"github.com/ncruces/zenity/internal/zenutil"
)
func progress(opts options) (ProgressDialog, error) {
2021-04-30 14:19:14 -04:00
if opts.extraButton != nil {
return nil, ErrUnsupported
2021-04-25 13:34:56 -04:00
}
2021-04-30 14:19:14 -04:00
var data zenutil.Progress
data.Description = opts.title
2021-04-25 13:34:56 -04:00
if opts.maxValue == 0 {
opts.maxValue = 100
}
if opts.maxValue >= 0 {
2021-04-30 14:19:14 -04:00
data.Total = &opts.maxValue
2021-04-25 13:34:56 -04:00
}
2021-04-30 14:19:14 -04:00
return zenutil.RunProgress(opts.ctx, opts.maxValue, data)
2021-04-25 13:34:56 -04:00
}