diff options
author | fiaxh <git@lightrise.org> | 2019-07-18 02:03:42 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-07-18 02:03:42 +0200 |
commit | f0abb8aaf9d06106235ca5e0e6b3ca2e425c4422 (patch) | |
tree | 03fce63f8c37b50b5202690a6801234724ed0021 /main/src/ui/conversation_selector | |
parent | 30353e92d63c033857ad0396c921b3bf5cab44c3 (diff) | |
download | dino-f0abb8aaf9d06106235ca5e0e6b3ca2e425c4422.tar.gz dino-f0abb8aaf9d06106235ca5e0e6b3ca2e425c4422.zip |
Refactor file receive/send interfaces and UI
Diffstat (limited to 'main/src/ui/conversation_selector')
-rw-r--r-- | main/src/ui/conversation_selector/conversation_selector.vala | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/main/src/ui/conversation_selector/conversation_selector.vala b/main/src/ui/conversation_selector/conversation_selector.vala index 290e297f..66cb3495 100644 --- a/main/src/ui/conversation_selector/conversation_selector.vala +++ b/main/src/ui/conversation_selector/conversation_selector.vala @@ -11,7 +11,6 @@ public class ConversationSelector : ListBox { public signal void conversation_selected(Conversation conversation); private StreamInteractor stream_interactor; - private string[]? filter_values; private HashMap<Conversation, ConversationSelectorRow> rows = new HashMap<Conversation, ConversationSelectorRow>(Conversation.hash_func, Conversation.equals_func); public ConversationSelector init(StreamInteractor stream_interactor) { @@ -19,8 +18,7 @@ public class ConversationSelector : ListBox { stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect(add_conversation); stream_interactor.get_module(ConversationManager.IDENTITY).conversation_deactivated.connect(remove_conversation); - stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(on_message_received); - stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(on_message_received); + stream_interactor.get_module(ContentItemStore.IDENTITY).new_item.connect(on_content_item_received); Timeout.add_seconds(60, () => { foreach (ConversationSelectorRow row in rows.values) row.update(); return true; @@ -34,7 +32,6 @@ public class ConversationSelector : ListBox { construct { get_style_context().add_class("sidebar"); - set_filter_func(filter); set_header_func(header); set_sort_func(sort); @@ -54,14 +51,6 @@ public class ConversationSelector : ListBox { } } - public void set_filter_values(string[]? values) { - if (filter_values == values) { - return; - } - filter_values = values; - invalidate_filter(); - } - public void on_conversation_selected(Conversation conversation) { if (!rows.has_key(conversation)) { add_conversation(conversation); @@ -70,7 +59,7 @@ public class ConversationSelector : ListBox { this.select_row(rows[conversation]); } - private void on_message_received(Entities.Message message, Conversation conversation) { + private void on_content_item_received(ContentItem item, Conversation conversation) { if (rows.has_key(conversation)) { invalidate_sort(); } @@ -128,21 +117,6 @@ public class ConversationSelector : ListBox { } } - private bool filter(ListBoxRow r) { - ConversationSelectorRow? row = r as ConversationSelectorRow; - if (row != null) { - if (filter_values != null && filter_values.length != 0) { - foreach (string filter in filter_values) { - if (!(Util.get_conversation_display_name(stream_interactor, row.conversation).down().contains(filter.down()) || - row.conversation.counterpart.to_string().down().contains(filter.down()))) { - return false; - } - } - } - } - return true; - } - private int sort(ListBoxRow row1, ListBoxRow row2) { ConversationSelectorRow cr1 = row1 as ConversationSelectorRow; ConversationSelectorRow cr2 = row2 as ConversationSelectorRow; |