]> git.armaanb.net Git - chorizo.git/commitdiff
Clip return value of webkit_download_get_estimated_progress() to [0, 1]
authorPeter Hofmann <scm@uninformativ.de>
Wed, 14 Dec 2016 15:44:36 +0000 (16:44 +0100)
committerPeter Hofmann <scm@uninformativ.de>
Wed, 14 Dec 2016 15:44:36 +0000 (16:44 +0100)
Closes #23.

CHANGES
browser.c

diff --git a/CHANGES b/CHANGES
index 52a7129a3ad4e5ab9d2fc02a89a0af398bc4f63b..89513622eadeeca1ac52fc318d69f929fc574b0b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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,
index 616f485383031c983d5a2836ca2fafe49ebd5004..219bc057ae1d39be86de7e63dd3fb200e0ed24d2 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -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;