Deactivate spinner in file widget as soon as its not displayed anymore (CPU usage)
This commit is contained in:
parent
c8f2b80978
commit
0f0e838a1f
|
@ -136,7 +136,7 @@ public class ConversationSelectorRow : ListBoxRow {
|
||||||
nick_label.label = last_message.direction == Message.DIRECTION_SENT ? _("Me") + ": " : "";
|
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);
|
message_label.label = Util.summarize_whitespaces_to_space(last_message.body);
|
||||||
break;
|
break;
|
||||||
case FileItem.TYPE:
|
case FileItem.TYPE:
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class FileWidget : Box {
|
||||||
main_box = new Box(Orientation.HORIZONTAL, 10) { halign=Align.FILL, hexpand=true, visible=true };
|
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 };
|
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 };
|
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 };
|
EventBox stack_event_box = new EventBox() { visible=true };
|
||||||
image_stack = new Stack() { transition_type = StackTransitionType.CROSSFADE, transition_duration=50, valign=Align.CENTER, 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;
|
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;
|
string? mime_description = file_transfer.mime_type != null ? ContentType.get_description(file_transfer.mime_type) : null;
|
||||||
|
|
||||||
switch (file_transfer.state) {
|
switch (file_transfer.state) {
|
||||||
|
@ -268,6 +270,7 @@ public class FileWidget : Box {
|
||||||
break;
|
break;
|
||||||
case FileTransfer.State.IN_PROGRESS:
|
case FileTransfer.State.IN_PROGRESS:
|
||||||
mime_label.label = "<span size='small'>" + _("Downloading %s…").printf(get_size_string(file_transfer.size)) + "</span>";
|
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");
|
image_stack.set_visible_child_name("spinner");
|
||||||
break;
|
break;
|
||||||
case FileTransfer.State.NOT_STARTED:
|
case FileTransfer.State.NOT_STARTED:
|
||||||
|
|
Loading…
Reference in a new issue