aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_summary/file_widget.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-09-13 12:28:44 +0200
committerfiaxh <git@lightrise.org>2019-09-14 16:08:27 +0200
commit0f0e838a1f76f605051936ad6c7d47e149a9b05e (patch)
tree2b989a3a9301970061503923b257b9cc78828cdb /main/src/ui/conversation_summary/file_widget.vala
parentc8f2b80978706c4c53deb7ddfb8188c751bcb291 (diff)
downloaddino-0f0e838a1f76f605051936ad6c7d47e149a9b05e.tar.gz
dino-0f0e838a1f76f605051936ad6c7d47e149a9b05e.zip
Deactivate spinner in file widget as soon as its not displayed anymore (CPU usage)
Diffstat (limited to 'main/src/ui/conversation_summary/file_widget.vala')
-rw-r--r--main/src/ui/conversation_summary/file_widget.vala5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/src/ui/conversation_summary/file_widget.vala b/main/src/ui/conversation_summary/file_widget.vala
index 178eb31d..7e662917 100644
--- a/main/src/ui/conversation_summary/file_widget.vala
+++ b/main/src/ui/conversation_summary/file_widget.vala
@@ -151,7 +151,7 @@ public class FileWidget : Box {
main_box = new Box(Orientation.HORIZONTAL, 10) { halign=Align.FILL, hexpand=true, visible=true };
content_type_image = new Image.from_icon_name(icon_name, IconSize.DND) { opacity=0.5, visible=true };
download_image = new Image.from_icon_name("dino-file-download-symbolic", IconSize.DND) { opacity=0.7, visible=true };
- spinner = new Spinner() { active=true, visible=true };
+ spinner = new Spinner() { visible=true };
EventBox stack_event_box = new EventBox() { visible=true };
image_stack = new Stack() { transition_type = StackTransitionType.CROSSFADE, transition_duration=50, valign=Align.CENTER, visible=true };
@@ -259,6 +259,8 @@ public class FileWidget : Box {
state = State.IMAGE;
}
+ spinner.active = false; // A hidden spinning spinner still uses CPU. Deactivate asap
+
string? mime_description = file_transfer.mime_type != null ? ContentType.get_description(file_transfer.mime_type) : null;
switch (file_transfer.state) {
@@ -268,6 +270,7 @@ public class FileWidget : Box {
break;
case FileTransfer.State.IN_PROGRESS:
mime_label.label = "<span size='small'>" + _("Downloading %s…").printf(get_size_string(file_transfer.size)) + "</span>";
+ spinner.active = true;
image_stack.set_visible_child_name("spinner");
break;
case FileTransfer.State.NOT_STARTED: