aboutsummaryrefslogtreecommitdiff
path: root/main/src
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
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')
-rw-r--r--main/src/ui/conversation_selector/conversation_selector_row.vala2
-rw-r--r--main/src/ui/conversation_summary/file_widget.vala5
2 files changed, 5 insertions, 2 deletions
diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala
index c7331b31..8d601309 100644
--- a/main/src/ui/conversation_selector/conversation_selector_row.vala
+++ b/main/src/ui/conversation_selector/conversation_selector_row.vala
@@ -136,7 +136,7 @@ public class ConversationSelectorRow : ListBoxRow {
nick_label.label = last_message.direction == Message.DIRECTION_SENT ? _("Me") + ": " : "";
}
- name_label.attributes.filter((attr) => attr.equal(attr_style_new(Pango.Style.ITALIC)));
+ message_label.attributes.filter((attr) => attr.equal(attr_style_new(Pango.Style.ITALIC)));
message_label.label = Util.summarize_whitespaces_to_space(last_message.body);
break;
case FileItem.TYPE:
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: