diff options
author | fiaxh <git@lightrise.org> | 2024-12-02 20:42:45 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2025-01-12 19:35:06 +0100 |
commit | d78ec0562288fa4ed7d414d2269c00b7b8c2c588 (patch) | |
tree | cb93751ba7ddbf883f41c728e6147b85b4a4acac /libdino | |
parent | d5c280476902d72627c863177a6adcbef4f94f3e (diff) | |
download | dino-d78ec0562288fa4ed7d414d2269c00b7b8c2c588.tar.gz dino-d78ec0562288fa4ed7d414d2269c00b7b8c2c588.zip |
Show file upload/download progress
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/service/file_manager.vala | 12 | ||||
-rw-r--r-- | libdino/src/service/jingle_file_transfers.vala | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala index 2a665e1e..fa3042dd 100644 --- a/libdino/src/service/file_manager.vala +++ b/libdino/src/service/file_manager.vala @@ -152,6 +152,10 @@ public class FileManager : StreamInteractionModule, Object { // Update current download progress in the FileTransfer LimitInputStream? limit_stream = file_transfer.input_stream as LimitInputStream; + if (limit_stream == null) { + limit_stream = new LimitInputStream(file_transfer.input_stream, file_meta.size); + file_transfer.input_stream = limit_stream; + } if (limit_stream != null) { limit_stream.bind_property("retrieved-bytes", file_transfer, "transferred-bytes", BindingFlags.SYNC_CREATE); } @@ -267,9 +271,6 @@ public class FileManager : StreamInteractionModule, Object { FileMeta file_meta = yield get_file_meta(file_provider, file_transfer, conversation, receive_data); - - InputStream? input_stream = null; - // Download and decrypt file file_transfer.state = FileTransfer.State.IN_PROGRESS; @@ -277,13 +278,14 @@ public class FileManager : StreamInteractionModule, Object { file_meta = file_decryptor.prepare_download_file(conversation, file_transfer, receive_data, file_meta); } - input_stream = yield file_provider.download(file_transfer, receive_data, file_meta); + InputStream download_input_stream = yield file_provider.download(file_transfer, receive_data, file_meta); + InputStream input_stream = download_input_stream; if (file_decryptor != null) { input_stream = yield file_decryptor.decrypt_file(input_stream, conversation, file_transfer, receive_data); } // Update current download progress in the FileTransfer - LimitInputStream? limit_stream = input_stream as LimitInputStream; + LimitInputStream? limit_stream = download_input_stream as LimitInputStream; if (limit_stream != null) { limit_stream.bind_property("retrieved-bytes", file_transfer, "transferred-bytes", BindingFlags.SYNC_CREATE); } diff --git a/libdino/src/service/jingle_file_transfers.vala b/libdino/src/service/jingle_file_transfers.vala index e0d3fce1..9e9d7ec8 100644 --- a/libdino/src/service/jingle_file_transfers.vala +++ b/libdino/src/service/jingle_file_transfers.vala @@ -103,7 +103,7 @@ public class JingleFileProvider : FileProvider, Object { throw new IOError.FAILED("Transfer data not available anymore"); } yield jingle_file_transfer.accept(stream); - return jingle_file_transfer.stream; + return new LimitInputStream(jingle_file_transfer.stream, file_meta.size); } public int get_id() { |