diff options
| author | fiaxh <git@lightrise.org> | 2025-06-14 21:48:14 +0200 |
|---|---|---|
| committer | fiaxh <git@lightrise.org> | 2025-06-14 21:48:14 +0200 |
| commit | b2163a7ca561cf18e425f28fc71d1230b0def0d1 (patch) | |
| tree | d3a1ad457915d9f185e564f2ac4c3f934f72fb76 /main/src/ui/conversation_content_view | |
| parent | bd8f277b9129a48a95ee19a2a3ec41d13aa66d4a (diff) | |
File Send Dialog: Make file widget static
Diffstat (limited to 'main/src/ui/conversation_content_view')
| -rw-r--r-- | main/src/ui/conversation_content_view/file_default_widget.vala | 10 | ||||
| -rw-r--r-- | main/src/ui/conversation_content_view/file_widget.vala | 1 |
2 files changed, 10 insertions, 1 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 aaf36b57..f9e4015e 100644 --- a/main/src/ui/conversation_content_view/file_default_widget.vala +++ b/main/src/ui/conversation_content_view/file_default_widget.vala @@ -20,7 +20,7 @@ public class FileDefaultWidget : Box { private FileTransfer.State state; - public FileDefaultWidget() { + public void init_updating_file_info() { EventControllerMotion this_motion_events = new EventControllerMotion(); this.add_controller(this_motion_events); this_motion_events.enter.connect(on_pointer_entered_event); @@ -39,6 +39,14 @@ public class FileDefaultWidget : Box { }); } + public void set_static_file_info(string? mime_type) { + spinner.stop(); // A hidden spinning spinner still uses CPU. Deactivate asap + + image_stack.set_visible_child_name("content_type_image"); + content_type_image.icon_name = get_file_icon_name(mime_type); + mime_label.label = mime_type != null ? ContentType.get_description(mime_type) : null; + } + public void update_file_info(string? mime_type, FileTransfer.State state, bool direction, int64 size, int64 transferred_bytes) { this.state = state; diff --git a/main/src/ui/conversation_content_view/file_widget.vala b/main/src/ui/conversation_content_view/file_widget.vala index 2b62f769..f031db21 100644 --- a/main/src/ui/conversation_content_view/file_widget.vala +++ b/main/src/ui/conversation_content_view/file_widget.vala @@ -213,6 +213,7 @@ public class FileDefaultWidgetController : Object { public void set_file_transfer(FileTransfer file_transfer) { this.file_transfer = file_transfer; + widget.init_updating_file_info(); widget.name_label.label = file_transfer.file_name; file_transfer.bind_property("state", this, "file-transfer-state"); |
