diff options
author | James Bursa <james@netsurf-browser.org> | 2003-08-28 20:04:35 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2003-08-28 20:04:35 +0000 |
commit | 3ce4ce9653fa2d5e68a7800a8943a9d2ace15bba (patch) | |
tree | 89795582970ec74940160a7cd95833b5b3459fd8 /content/fetchcache.c | |
parent | cef8c477c396458269a91ee756fc711bed74d0f4 (diff) | |
download | netsurf-3ce4ce9653fa2d5e68a7800a8943a9d2ace15bba.tar.gz netsurf-3ce4ce9653fa2d5e68a7800a8943a9d2ace15bba.tar.bz2 |
[project @ 2003-08-28 20:04:35 by bursa]
Use Content-Length to give percentage downloads.
svn path=/import/netsurf/; revision=256
Diffstat (limited to 'content/fetchcache.c')
-rw-r--r-- | content/fetchcache.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/content/fetchcache.c b/content/fetchcache.c index 99686efe0..1c950ba4b 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -66,6 +66,7 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size) switch (msg) { case FETCH_TYPE: + c->total_size = size; mime_type = xstrdup(data); if ((semic = strchr(mime_type, ';')) != 0) *semic = 0; /* remove "; charset=..." */ @@ -78,7 +79,12 @@ void fetchcache_callback(fetch_msg msg, void *p, char *data, unsigned long size) case FETCH_DATA: LOG(("FETCH_DATA")); c->fetch_size += size; - sprintf(c->status_message, "Received %lu bytes", c->fetch_size); + if (c->total_size) + sprintf(c->status_message, "Received %lu of %lu bytes (%u%%)", + c->fetch_size, c->total_size, + (unsigned int) (c->fetch_size * 100.0 / c->total_size)); + else + sprintf(c->status_message, "Received %lu bytes", c->fetch_size); content_broadcast(c, CONTENT_MSG_STATUS, 0); content_process_data(c, data, size); break; |