aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-10-11 12:16:38 +0200
committerfiaxh <git@lightrise.org>2020-10-11 12:16:38 +0200
commit78138bf39b2da8e11983f4c4e36e808ec9ebeda4 (patch)
tree8e10d41b8ba498397c0228e21ef80a723623f3d9 /main
parentf28aaac6dae73d87ce85a6525a5491bd0cda7a52 (diff)
downloaddino-78138bf39b2da8e11983f4c4e36e808ec9ebeda4.tar.gz
dino-78138bf39b2da8e11983f4c4e36e808ec9ebeda4.zip
Unregister handlers related to displaying messages as pending
Diffstat (limited to 'main')
-rw-r--r--main/src/ui/conversation_content_view/message_widget.vala9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/src/ui/conversation_content_view/message_widget.vala b/main/src/ui/conversation_content_view/message_widget.vala
index 8e164857..3186cfbb 100644
--- a/main/src/ui/conversation_content_view/message_widget.vala
+++ b/main/src/ui/conversation_content_view/message_widget.vala
@@ -87,6 +87,7 @@ public class MessageItemWidget : SizeRequestBin {
ulong realize_id = -1;
ulong style_updated_id = -1;
+ ulong marked_notify_handler_id = -1;
construct {
this.add(label);
@@ -186,12 +187,16 @@ public class MessageItemWidget : SizeRequestBin {
theme_dependent = true;
}
+ // Append "pending..." iff message has not been sent yet
if (message.direction == Message.DIRECTION_SENT && (message.marked == Message.Marked.SENDING || message.marked == Message.Marked.UNSENT)) {
if (message.local_time.compare(new DateTime.now_utc().add_seconds(-10)) < 0) {
markup_text += " <span size='small' color='%s'>%s</span>".printf(gray_color, "pending…");
- message.bind_property("marked", this, "marked");
- this.notify["marked"].connect(() => {
+ // Update the label as soon as the sent state changes
+ var binding = message.bind_property("marked", this, "marked");
+ marked_notify_handler_id = this.notify["marked"].connect(() => {
+ binding.unbind();
+ this.disconnect(marked_notify_handler_id);
update_label();
});
} else {