From 3af9faac82dc19d5d9059d190cc17ce7186e4a10 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 4 Nov 2018 20:19:34 +0100 Subject: Use ContentItems in ConversationSelector, Chat/Groupchat(Pm)Row -> ConversationRow --- libdino/src/service/content_item_store.vala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libdino') diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala index 0b89e288..1886236c 100644 --- a/libdino/src/service/content_item_store.vala +++ b/libdino/src/service/content_item_store.vala @@ -82,7 +82,15 @@ public class ContentItemStore : StreamInteractionModule, Object { return item.size > 0 ? item[0] : null; } - public Gee.List get_latest(Conversation conversation, int count) { + public ContentItem? get_latest(Conversation conversation) { + Gee.List items = get_n_latest(conversation, 1); + if (items.size > 0) { + return items.get(0); + } + return null; + } + + public Gee.List get_n_latest(Conversation conversation, int count) { QueryBuilder select = db.content_item.select() .with(db.content_item.conversation_id, "=", conversation.id) .with(db.content_item.hide, "=", false) -- cgit v1.2.3-54-g00ecf