aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-09-19 23:23:12 +0200
committerfiaxh <git@mx.ax.lt>2017-09-19 23:39:17 +0200
commit7430efee5714232e1a0a704526098e58a9dc9352 (patch)
tree8f92e3e7185f07fc73e69aac3f1cfaa143a412b8 /main/src
parent8fdb38b99be9c588148d576c23212af765ff7302 (diff)
downloaddino-7430efee5714232e1a0a704526098e58a9dc9352.tar.gz
dino-7430efee5714232e1a0a704526098e58a9dc9352.zip
Change conversation (un)read marking
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_selector/conversation_row.vala15
-rw-r--r--main/src/ui/conversation_selector/list.vala6
2 files changed, 5 insertions, 16 deletions
diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala
index da9dbf68..a838124d 100644
--- a/main/src/ui/conversation_selector/conversation_row.vala
+++ b/main/src/ui/conversation_selector/conversation_row.vala
@@ -57,14 +57,7 @@ public abstract class ConversationRow : ListBoxRow {
last_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation) ?? m;
update_message_label();
update_time_label();
- }
-
- public void mark_read() {
- update_read(true);
- }
-
- public void mark_unread() {
- update_read(false);
+ update_read();
}
public virtual void on_show_received(Show presence) {
@@ -103,8 +96,10 @@ public abstract class ConversationRow : ListBoxRow {
}
}
- protected void update_read(bool read) {
- this.read = read;
+ protected void update_read() {
+ bool read_was = read;
+ read = last_message == null || (conversation.read_up_to != null && last_message.equals(conversation.read_up_to));
+ if (read == read_was) return;
if (read) {
name_label.attributes.filter((attr) => attr.equal(attr_weight_new(Weight.BOLD)));
time_label.attributes.filter((attr) => attr.equal(attr_weight_new(Weight.BOLD)));
diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala
index d49a009f..6e9a0ec2 100644
--- a/main/src/ui/conversation_selector/list.vala
+++ b/main/src/ui/conversation_selector/list.vala
@@ -22,12 +22,6 @@ public class List : ListBox {
set_header_func(header);
set_sort_func(sort);
- stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_read.connect((conversation) => {
- Idle.add(() => { if (rows.has_key(conversation)) rows[conversation].mark_read(); return false; });
- });
- stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_unread.connect((conversation) => {
- Idle.add(() => { if (rows.has_key(conversation)) rows[conversation].mark_unread(); return false; });
- });
stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => {
Idle.add(() => { add_conversation(conversation); return false; });
});