From d0e86d0a8ebb6bbb254a0fb7474d09c58d8379e3 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 31 Aug 2017 22:22:44 +0200 Subject: small fixes --- main/src/ui/conversation_summary/conversation_view.vala | 11 ++++++++++- main/src/ui/conversation_summary/default_message_display.vala | 1 + main/src/ui/conversation_summary/file_populator.vala | 1 + main/src/ui/conversation_summary/slashme_message_display.vala | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) (limited to 'main/src/ui/conversation_summary') diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala index 9379e8ba..3f5a85b6 100644 --- a/main/src/ui/conversation_summary/conversation_view.vala +++ b/main/src/ui/conversation_summary/conversation_view.vala @@ -16,7 +16,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection { [GtkChild] private Stack stack; private StreamInteractor stream_interactor; - private Gee.TreeSet meta_items = new TreeSet((a, b) => { return a.sort_time.compare(b.sort_time); }); + private Gee.TreeSet meta_items = new TreeSet(sort_meta_items); private Gee.Map> meta_after_items = new Gee.HashMap>(); private Gee.HashMap item_item_skeletons = new Gee.HashMap(); private Gee.HashMap widgets = new Gee.HashMap(); @@ -169,6 +169,15 @@ public class ConversationView : Box, Plugins.ConversationItemCollection { if (meta_items.size > 0) message_item_populator.populate_number(conversation, meta_items.first().sort_time, 20); } + private static int sort_meta_items(Plugins.MetaConversationItem a, Plugins.MetaConversationItem b) { + int res = a.sort_time.compare(b.sort_time); + if (res == 0) { + if (a.seccondary_sort_indicator < b.seccondary_sort_indicator) res = -1; + else if (a.seccondary_sort_indicator > b.seccondary_sort_indicator) res = 1; + } + return res; + } + // Workaround GTK TextView issues private void force_alloc_width(Widget widget, int width) { Allocation alloc = Allocation(); diff --git a/main/src/ui/conversation_summary/default_message_display.vala b/main/src/ui/conversation_summary/default_message_display.vala index 6082253d..44040a3b 100644 --- a/main/src/ui/conversation_summary/default_message_display.vala +++ b/main/src/ui/conversation_summary/default_message_display.vala @@ -35,6 +35,7 @@ public class MetaMessageItem : Plugins.MetaConversationItem { this.message = message; this.jid = message.from; this.sort_time = message.local_time; + this.seccondary_sort_indicator = message.id + 0.2085; this.display_time = message.time; this.encryption = message.encryption; } diff --git a/main/src/ui/conversation_summary/file_populator.vala b/main/src/ui/conversation_summary/file_populator.vala index 9046155a..d1a26d12 100644 --- a/main/src/ui/conversation_summary/file_populator.vala +++ b/main/src/ui/conversation_summary/file_populator.vala @@ -70,6 +70,7 @@ public class ImageItem : Plugins.MetaConversationItem { this.jid = file_transfer.direction == FileTransfer.DIRECTION_SENT ? new Jid.with_resource(file_transfer.account.bare_jid.to_string(), file_transfer.account.resourcepart) : file_transfer.counterpart; this.sort_time = file_transfer.time; + this.seccondary_sort_indicator = file_transfer.id + 0.2903; this.display_time = file_transfer.time; this.encryption = file_transfer.encryption; this.mark = file_to_message_state(file_transfer.state); diff --git a/main/src/ui/conversation_summary/slashme_message_display.vala b/main/src/ui/conversation_summary/slashme_message_display.vala index 58d93142..cb3d5cd2 100644 --- a/main/src/ui/conversation_summary/slashme_message_display.vala +++ b/main/src/ui/conversation_summary/slashme_message_display.vala @@ -41,6 +41,7 @@ public class MetaSlashmeItem : Plugins.MetaConversationItem { this.message = message; this.jid = message.from; this.sort_time = message.local_time; + this.seccondary_sort_indicator = message.id + 0.0845; this.display_time = message.time; this.encryption = message.encryption; } -- cgit v1.2.3-54-g00ecf