diff options
author | Peter Hofmann <scm@uninformativ.de> | 2016-12-14 16:44:36 +0100 |
---|---|---|
committer | Peter Hofmann <scm@uninformativ.de> | 2016-12-14 16:44:36 +0100 |
commit | e69feb178971514fb88aeaf40ba918e78ea0d24c (patch) | |
tree | 8a7d929672ea74875a82c4f4c0acc0bceedc14fc | |
parent | 657cca73535fafb569af6dc15d2aec24be1a5685 (diff) | |
download | lariza-e69feb178971514fb88aeaf40ba918e78ea0d24c.tar.gz |
Clip return value of webkit_download_get_estimated_progress() to [0, 1]
Closes #23.
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | browser.c | 5 |
2 files changed, 8 insertions, 1 deletions
@@ -1,6 +1,10 @@ Release history for lariza next + [Fixed] + - Lariza no longer reports download progress below 0% or above 100%. + (Workaround for what appears to be a WebKit2GTK+ bug.) + [Changed] - We no longer explicitly set the X11 window's class and name. Let GTK+ do this job. The actual class and name should be unchanged, @@ -279,7 +279,10 @@ changed_download_progress(GObject *obj, GParamSpec *pspec, gpointer data) const gchar *uri; gchar *t, *filename, *base; - p = webkit_download_get_estimated_progress(download) * 100; + p = webkit_download_get_estimated_progress(download); + p = p > 1 ? 1 : p; + p = p < 0 ? 0 : p; + p *= 100; resp = webkit_download_get_response(download); size_mb = webkit_uri_response_get_content_length(resp) / 1e6; |