aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_content_view
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-07-15 15:08:56 +0200
committerfiaxh <git@lightrise.org>2020-07-16 23:31:19 +0200
commit7309c6f3ac4e580f197b4835d05bb011fa90780b (patch)
treede269a5c89ea5d7b01d35f011d928f678e076c8f /main/src/ui/conversation_content_view
parente159fd2492c28c1ef4ab64828ca0e8c2de877b41 (diff)
downloaddino-7309c6f3ac4e580f197b4835d05bb011fa90780b.tar.gz
dino-7309c6f3ac4e580f197b4835d05bb011fa90780b.zip
Visually highlight pending messages, improve resending
Diffstat (limited to 'main/src/ui/conversation_content_view')
-rw-r--r--main/src/ui/conversation_content_view/message_widget.vala23
1 files changed, 21 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 13b48a1e..83d826e9 100644
--- a/main/src/ui/conversation_content_view/message_widget.vala
+++ b/main/src/ui/conversation_content_view/message_widget.vala
@@ -80,6 +80,7 @@ public class MessageItemWidget : SizeRequestBin {
StreamInteractor stream_interactor;
public ContentItem content_item;
+ public Message.Marked marked { get; set; }
Label label = new Label("") { use_markup=true, xalign=0, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, vexpand=true, visible=true };
MessageItemEditMode? edit_mode = null;
@@ -179,12 +180,30 @@ public class MessageItemWidget : SizeRequestBin {
markup_text = @"<span size=\'$size_str\'>" + markup_text + "</span>";
}
+ string gray_color = Util.is_dark_theme(label) ? "#808080" : "#909090";
+
if (message.edit_to != null) {
- string color = Util.is_dark_theme(label) ? "#808080" : "#909090";
- markup_text += " <span size='small' color='%s'>(%s)</span>".printf(color, _("edited"));
+ markup_text += " <span size='small' color='%s'>(%s)</span>".printf(gray_color, _("edited"));
theme_dependent = true;
}
+ 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_label();
+ });
+ } else {
+ int time_diff = (- (int) message.local_time.difference(new DateTime.now_utc()) / 1000);
+ Timeout.add(10000 - time_diff, () => {
+ update_label();
+ return false;
+ });
+ }
+ }
+
if (theme_dependent && realize_id == -1) {
realize_id = label.realize.connect(update_label);
style_updated_id = label.style_updated.connect(update_label);