X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=window.ml;h=6e720b7b4b4e4ffcf98d73c317bec4c4f3a78794;hb=refs%2Ftags%2F0.1.7;hp=dd4f5ad7a166b10fd663aab5d43834f6ccc1d2d6;hpb=4fa4ca7430421c477e7f813819a8a70279de0a65;p=guestfs-browser.git diff --git a/window.ml b/window.ml index dd4f5ad..6e720b7 100644 --- a/window.ml +++ b/window.ml @@ -116,8 +116,16 @@ let throbber_idle ws () = ws.throbber#set_pixbuf ws.throbber_static let progress ws (position, total) = - ws.progress_bar#set_fraction - (Int64.to_float position /. Int64.to_float total) + if position = 0L && total = 1L then + ws.progress_bar#pulse () + else ( + let frac = Int64.to_float position /. Int64.to_float total in + if frac < 0. || frac > 1. then + eprintf "warning: progress bar out of range: %Ld / %Ld (%g)\n" + position total frac; + let frac = if frac < 0. then 0. else if frac > 1. then 1. else frac in + ws.progress_bar#set_fraction frac + ) (* This is called in the main thread whenever a command fails in the * slave thread. The command queue has been cleared before this is