From db57a973534f099af2b150f1a1307d1948553d9f Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 19 Mar 2017 12:55:36 +0100 Subject: Add typed identity to manager modules and stream flags --- main/src/ui/conversation_selector/chat_row.vala | 6 +++--- .../ui/conversation_selector/conversation_row.vala | 2 +- .../ui/conversation_selector/groupchat_row.vala | 4 ++-- main/src/ui/conversation_selector/list.vala | 22 +++++++++++----------- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'main/src/ui/conversation_selector') diff --git a/main/src/ui/conversation_selector/chat_row.vala b/main/src/ui/conversation_selector/chat_row.vala index 96f6921d..5e3270aa 100644 --- a/main/src/ui/conversation_selector/chat_row.vala +++ b/main/src/ui/conversation_selector/chat_row.vala @@ -40,7 +40,7 @@ public class ChatRow : ConversationRow { } public void update_avatar() { - ArrayList full_jids = PresenceManager.get_instance(stream_interactor).get_full_jids(conversation.counterpart, conversation.account); + ArrayList full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(conversation.counterpart, conversation.account); set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor)) .set_greyscale(full_jids == null) .draw_conversation(stream_interactor, conversation), image.scale_factor); @@ -54,12 +54,12 @@ public class ChatRow : ConversationRow { jid_label.label = conversation.counterpart.to_string(); - ArrayList? full_jids = PresenceManager.get_instance(stream_interactor).get_full_jids(conversation.counterpart, conversation.account); + ArrayList? full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(conversation.counterpart, conversation.account); if (full_jids != null) { for (int i = 0; i < full_jids.size; i++) { Box box = new Box(Orientation.HORIZONTAL, 5); - Show show = PresenceManager.get_instance(stream_interactor).get_last_show(full_jids[i], conversation.account); + Show show = stream_interactor.get_module(PresenceManager.IDENTITY).get_last_show(full_jids[i], conversation.account); Image image = new Image(); if (show.as == Show.AWAY) { image.set_from_icon_name("dino-status-away", IconSize.SMALL_TOOLBAR); diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala index ef3984c1..c16da287 100644 --- a/main/src/ui/conversation_selector/conversation_row.vala +++ b/main/src/ui/conversation_selector/conversation_row.vala @@ -46,7 +46,7 @@ public abstract class ConversationRow : ListBoxRow { x_button.clicked.connect(on_x_button_clicked); update_name(Util.get_conversation_display_name(stream_interactor, conversation)); - Entities.Message message = MessageManager.get_instance(stream_interactor).get_last_message(conversation); + Entities.Message message = stream_interactor.get_module(MessageManager.IDENTITY).get_last_message(conversation); if (message != null) { message_received(message); } diff --git a/main/src/ui/conversation_selector/groupchat_row.vala b/main/src/ui/conversation_selector/groupchat_row.vala index 7fe52d89..598902cc 100644 --- a/main/src/ui/conversation_selector/groupchat_row.vala +++ b/main/src/ui/conversation_selector/groupchat_row.vala @@ -23,12 +23,12 @@ public class GroupchatRow : ConversationRow { public override void network_connection(bool connected) { set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor)) .set_greyscale(!connected || - MucManager.get_instance(stream_interactor).get_nick(conversation.counterpart, conversation.account) == null) // TODO better currently joined + stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account) == null) // TODO better currently joined .draw_conversation(stream_interactor, conversation), image.scale_factor); } private void on_x_button_clicked() { - MucManager.get_instance(stream_interactor).part(conversation.account, conversation.counterpart); + stream_interactor.get_module(MucManager.IDENTITY).part(conversation.account, conversation.counterpart); } } diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala index 071ac504..d95128f1 100644 --- a/main/src/ui/conversation_selector/list.vala +++ b/main/src/ui/conversation_selector/list.vala @@ -22,31 +22,31 @@ public class List : ListBox { set_header_func(header); set_sort_func(sort); - ChatInteraction.get_instance(stream_interactor).conversation_read.connect((conversation) => { + stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_read.connect((conversation) => { Idle.add(() => {if (rows.has_key(conversation)) rows[conversation].mark_read(); return false;}); }); - ChatInteraction.get_instance(stream_interactor).conversation_unread.connect((conversation) => { + stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_unread.connect((conversation) => { Idle.add(() => {if (rows.has_key(conversation)) rows[conversation].mark_unread(); return false;}); }); - ConversationManager.get_instance(stream_interactor).conversation_activated.connect((conversation) => { + stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => { Idle.add(() => {add_conversation(conversation); return false;}); }); - MessageManager.get_instance(stream_interactor).message_received.connect((message, conversation) => { + stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect((message, conversation) => { Idle.add(() => {on_message_received(message, conversation); return false;}); }); - MessageManager.get_instance(stream_interactor).message_sent.connect((message, conversation) => { + stream_interactor.get_module(MessageManager.IDENTITY).message_sent.connect((message, conversation) => { Idle.add(() => {on_message_received(message, conversation); return false;}); }); - PresenceManager.get_instance(stream_interactor).show_received.connect((show, jid, account) => { + stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((show, jid, account) => { Idle.add(() => { - Conversation? conversation = ConversationManager.get_instance(stream_interactor).get_conversation(jid, account); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); if (conversation != null && rows.has_key(conversation)) rows[conversation].on_show_received(show); return false; }); }); - RosterManager.get_instance(stream_interactor).updated_roster_item.connect((account, jid, roster_item) => { + stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect((account, jid, roster_item) => { Idle.add(() => { - Conversation? conversation = ConversationManager.get_instance(stream_interactor).get_conversation(jid, account); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); if (conversation != null && rows.has_key(conversation)) { ChatRow row = rows[conversation] as ChatRow; if (row != null) row.on_updated_roster_item(roster_item); @@ -54,9 +54,9 @@ public class List : ListBox { return false; }); }); - AvatarManager.get_instance(stream_interactor).received_avatar.connect((avatar, jid, account) => { + stream_interactor.get_module(AvatarManager.IDENTITY).received_avatar.connect((avatar, jid, account) => { Idle.add(() => { - Conversation? conversation = ConversationManager.get_instance(stream_interactor).get_conversation(jid, account); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); if (conversation != null && rows.has_key(conversation)) { ChatRow row = rows[conversation] as ChatRow; if (row != null) row.update_avatar(); -- cgit v1.2.3-70-g09d2