From 6a1f057de2d446e6b9c21f377cf0ec79930369c0 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 25 May 2019 21:57:23 +0200 Subject: Fix date separators --- main/src/ui/conversation_summary/conversation_view.vala | 12 +++++++----- .../ui/conversation_summary/date_separator_populator.vala | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'main/src/ui') diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala index 0216e891..3592a6c1 100644 --- a/main/src/ui/conversation_summary/conversation_view.vala +++ b/main/src/ui/conversation_summary/conversation_view.vala @@ -44,8 +44,6 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins content_populator = new ContentProvider(stream_interactor); subscription_notification = new SubscriptionNotitication(stream_interactor); - insert_item.connect(filter_insert_item); - remove_item.connect(do_remove_item); add_meta_notification.connect(on_add_meta_notification); remove_meta_notification.connect(on_remove_meta_notification); @@ -171,7 +169,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins Idle.add(() => { on_value_notify(); return false; }); } - public void filter_insert_item(Plugins.MetaConversationItem item) { + public void insert_item(Plugins.MetaConversationItem item) { if (meta_items.size > 0) { bool after_last = meta_items.last().sort_time.compare(item.sort_time) < 0; bool within_range = meta_items.last().sort_time.compare(item.sort_time) > 0 && meta_items.first().sort_time.compare(item.sort_time) < 0; @@ -193,9 +191,11 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins content_items.add(item); } meta_items.add(item); + + inserted_item(item); } - private void do_remove_item(Plugins.MetaConversationItem item) { + private void remove_item(Plugins.MetaConversationItem item) { ConversationItemSkeleton? skeleton = item_item_skeletons[item]; if (skeleton != null) { if (skeleton.items.size > 1) { @@ -210,6 +210,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins content_items.remove(item); meta_items.remove(item); } + + removed_item(item); } public void on_add_meta_notification(Plugins.MetaConversationNotification notification) { @@ -317,7 +319,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins while(i < split_skeleton.items.size) { Plugins.MetaConversationItem meta_item = split_skeleton.items[i]; if (time.compare(meta_item.display_time) < 0) { - do_remove_item(meta_item); + remove_item(meta_item); if (!already_divided) { insert_new(meta_item); already_divided = true; diff --git a/main/src/ui/conversation_summary/date_separator_populator.vala b/main/src/ui/conversation_summary/date_separator_populator.vala index 6a1ba782..a5c1a887 100644 --- a/main/src/ui/conversation_summary/date_separator_populator.vala +++ b/main/src/ui/conversation_summary/date_separator_populator.vala @@ -23,19 +23,19 @@ class DateSeparatorPopulator : Plugins.ConversationItemPopulator, Plugins.Conver public void init(Conversation conversation, Plugins.ConversationItemCollection item_collection, Plugins.WidgetType type) { current_conversation = conversation; this.item_collection = item_collection; - item_collection.insert_item.connect(on_insert_item); + item_collection.inserted_item.connect(on_inserted_item); this.insert_times = new TreeSet((a, b) => { return a.compare(b); }); } public void close(Conversation conversation) { - item_collection.insert_item.disconnect(on_insert_item); + item_collection.inserted_item.disconnect(on_inserted_item); } public void populate_timespan(Conversation conversation, DateTime after, DateTime before) { } - private void on_insert_item(Plugins.MetaConversationItem item) { + private void on_inserted_item(Plugins.MetaConversationItem item) { if (item.display_time == null) return; DateTime time = item.sort_time.to_local(); -- cgit v1.2.3-70-g09d2