aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-04 01:23:11 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-09 16:38:02 +0200
commit6d3aef271875eba7a3867259f2089e3801141b19 (patch)
treefb8d639dd84c3c0242cd8bf5ea8f73b83a4c0bc8 /plugins
parentf3c50f07395f0e3331c4389015fe26ef53213c83 (diff)
downloaddino-6d3aef271875eba7a3867259f2089e3801141b19.tar.gz
Show file upload/download progress
Fixes upstream issue #1350. Notes: Image uploads were incorrectly handled by Dino, as they were always reported as completed even if they were not, maybe so as to show the image preview from the start. Now, Dino shows the upload progress for all file types, and the image is only shown when completed.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/http-files/src/file_sender.vala12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/http-files/src/file_sender.vala b/plugins/http-files/src/file_sender.vala
index 8f9f02fc..17dbc6cf 100644
--- a/plugins/http-files/src/file_sender.vala
+++ b/plugins/http-files/src/file_sender.vala
@@ -106,6 +106,18 @@ public class HttpFileSender : FileSender, Object {
put_message.wrote_headers.connect(() => transfer_more_bytes(file_transfer.input_stream, put_message.request_body));
put_message.wrote_chunk.connect(() => transfer_more_bytes(file_transfer.input_stream, put_message.request_body));
#endif
+
+ file_transfer.transferred_bytes = 0;
+ put_message.wrote_body_data.connect((chunk) => {
+ if (file_transfer.size != 0) {
+#if SOUP_3_0
+ file_transfer.transferred_bytes += chunk;
+#else
+ file_transfer.transferred_bytes += chunk.length;
+#endif
+ }
+ });
+
foreach (var entry in file_send_data.headers.entries) {
put_message.request_headers.append(entry.key, entry.value);
}