diff options
Diffstat (limited to 'main/src/ui/conversation_content_view/file_default_widget.vala')
-rw-r--r-- | main/src/ui/conversation_content_view/file_default_widget.vala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/main/src/ui/conversation_content_view/file_default_widget.vala b/main/src/ui/conversation_content_view/file_default_widget.vala index 02249b3f..aaf36b57 100644 --- a/main/src/ui/conversation_content_view/file_default_widget.vala +++ b/main/src/ui/conversation_content_view/file_default_widget.vala @@ -39,7 +39,7 @@ public class FileDefaultWidget : Box { }); } - public void update_file_info(string? mime_type, FileTransfer.State state, int64 size) { + public void update_file_info(string? mime_type, FileTransfer.State state, bool direction, int64 size, int64 transferred_bytes) { this.state = state; spinner.stop(); // A hidden spinning spinner still uses CPU. Deactivate asap @@ -61,7 +61,17 @@ public class FileDefaultWidget : Box { popover_menu.closed.connect(on_pointer_left); break; case FileTransfer.State.IN_PROGRESS: - mime_label.label = _("Downloading %s…").printf(get_size_string(size)); + if (direction == FileTransfer.DIRECTION_RECEIVED) { + if (size > 0) { + int64 progress = transferred_bytes * 100 / size; + mime_label.label = _("Downloading %s… (%u%%)").printf(get_size_string(size), progress); + } else { + mime_label.label = _("Downloading %s…").printf(get_size_string(size)); + } + } else { + int64 progress = transferred_bytes * 100 / size; + mime_label.label = _("Uploading %s… (%u%%)").printf(get_size_string(size), progress); + } spinner.start(); image_stack.set_visible_child_name("spinner"); |