diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/ui/conversation_selector/conversation_row.vala | 15 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/list.vala | 6 |
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; }); }); |