-download(WebKitDownload *o, GParamSpec *pspec, gpointer d) {
- Client *c = (Client *) d;
- GSList *i;
- WebKitDownload *dl;
- GString *text;
-
- text = g_string_new("");
- for (i = downloads; i != NULL; i = i->next) {
- dl = i->data;
- if (webkit_download_get_status(dl) == WEBKIT_DOWNLOAD_STATUS_STARTED
- || webkit_download_get_status(dl) == WEBKIT_DOWNLOAD_STATUS_CREATED) {
- g_string_append_printf(text, "%s[%.0f%%] ",
- webkit_download_get_suggested_filename(dl),
- webkit_download_get_progress(dl)*100);
- } else {
- downloads = g_slist_remove(downloads, dl);
- }
- }
- if (downloads == NULL) {
- gtk_label_set_text((GtkLabel *) c->pbar, "");
- gtk_widget_hide(c->pbar);
- } else {
- gtk_label_set_text((GtkLabel *) c->pbar, text->str);
+download(WebKitDownload *o, GParamSpec *pspec, Client *c) {
+ WebKitDownloadStatus status;
+
+ status = webkit_download_get_status(c->download);
+ if(status == WEBKIT_DOWNLOAD_STATUS_STARTED || status == WEBKIT_DOWNLOAD_STATUS_CREATED) {
+ c->progress = (int)(webkit_download_get_progress(c->download)*100);