application/davcontroller.c

changeset 45
ab71409644b0
parent 31
bf810176ddb8
child 46
31bc86844659
equal deleted inserted replaced
44:473954dc6b74 45:ab71409644b0
705 char *sz_downloaded = util_size_str2(FALSE, download->downloaded_bytes, download->total_bytes, 2); 705 char *sz_downloaded = util_size_str2(FALSE, download->downloaded_bytes, download->total_bytes, 2);
706 char *sz_downloaded_end = strchr(sz_downloaded, ' '); 706 char *sz_downloaded_end = strchr(sz_downloaded, ' ');
707 if (sz_downloaded_end) { 707 if (sz_downloaded_end) {
708 *sz_downloaded_end = 0; 708 *sz_downloaded_end = 0;
709 } 709 }
710 710
711 if (download->total_bytes > 0) { 711 if (download->total_bytes > 0) {
712 double progress = (double)download->downloaded_bytes / (double)download->total_bytes; 712 double progress = (double)download->downloaded_bytes / (double)download->total_bytes;
713 ui_set(download->progress, progress*100); 713 ui_set(download->progress, progress*100);
714 } 714 }
715 715
778 file->fd = f; 778 file->fd = f;
779 779
780 DavResource *res = dav_resource_new(file->download->download_sn, file->path); 780 DavResource *res = dav_resource_new(file->download->download_sn, file->path);
781 dav_get_content(res, file, (dav_write_func)ddfile_write); 781 dav_get_content(res, file, (dav_write_func)ddfile_write);
782 782
783 file->download->downloaded_bytes += ftell(f);
784 file->download->downloaded_files++; 783 file->download->downloaded_files++;
785 784
786 ui_call_mainthread(uithr_download_update_progress, file->download); 785 ui_call_mainthread(uithr_download_update_progress, file->download);
787 786
788 dav_resource_free(res); 787 dav_resource_free(res);
926 ui_grid(dialog, .margin = 10, .spacing = 10, .fill = TRUE) { 925 ui_grid(dialog, .margin = 10, .spacing = 10, .fill = TRUE) {
927 ui_llabel(dialog, .value = download->label_top_left, .hexpand = TRUE); 926 ui_llabel(dialog, .value = download->label_top_left, .hexpand = TRUE);
928 ui_rlabel(dialog, .value = download->label_top_right); 927 ui_rlabel(dialog, .value = download->label_top_right);
929 ui_newline(dialog); 928 ui_newline(dialog);
930 929
931 ui_progressbar(dialog, .value = download->progress, .colspan = 2, .hexpand = TRUE); 930 ui_progressbar(dialog, .value = download->progress, .min = 0, .max = 100, .colspan = 2, .hexpand = TRUE);
932 ui_newline(dialog); 931 ui_newline(dialog);
933 932
934 ui_llabel(dialog, .value = download->label_bottom_left); 933 ui_llabel(dialog, .value = download->label_bottom_left);
935 ui_rlabel(dialog, .value = download->label_bottom_right); 934 ui_rlabel(dialog, .value = download->label_bottom_right);
936 ui_newline(dialog); 935 ui_newline(dialog);

mercurial