diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/ui/add_conversation/chat/roster_list.vala | 11 | ||||
-rw-r--r-- | main/src/ui/add_conversation/conference/conference_list.vala | 12 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/conversation_row.vala | 2 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/list.vala | 15 | ||||
-rw-r--r-- | main/src/ui/unified_window.vala | 8 |
5 files changed, 28 insertions, 20 deletions
diff --git a/main/src/ui/add_conversation/chat/roster_list.vala b/main/src/ui/add_conversation/chat/roster_list.vala index c395dc3a..d09720d5 100644 --- a/main/src/ui/add_conversation/chat/roster_list.vala +++ b/main/src/ui/add_conversation/chat/roster_list.vala @@ -11,7 +11,7 @@ protected class RosterList : FilterableList { public signal void conversation_selected(Conversation? conversation); private StreamInteractor stream_interactor; - private HashMap<Jid, ListRow> rows = new HashMap<Jid, ListRow>(Jid.hash_func, Jid.equals_func); + private HashMap<Account, HashMap<Jid, ListRow>> rows = new HashMap<Account, HashMap<Jid, ListRow>>(Account.hash_func, Account.equals_func); public RosterList(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; @@ -26,6 +26,7 @@ protected class RosterList : FilterableList { Idle.add(() => { on_updated_roster_item(account, jid, roster_item); return false;});}); foreach (Account account in stream_interactor.get_accounts()) { + rows[account] = new HashMap<Jid, ListRow>(Jid.hash_func, Jid.equals_func); foreach (Roster.Item roster_item in stream_interactor.get_module(RosterManager.IDENTITY).get_roster(account)) { on_updated_roster_item(account, new Jid(roster_item.jid), roster_item); } @@ -33,16 +34,16 @@ protected class RosterList : FilterableList { } private void on_removed_roster_item(Account account, Jid jid, Roster.Item roster_item) { - if (rows.has_key(jid)) { - remove(rows[jid]); - rows.unset(jid); + if (rows.has_key(account) && rows[account].has_key(jid)) { + remove(rows[account][jid]); + rows[account].unset(jid); } } private void on_updated_roster_item(Account account, Jid jid, Roster.Item roster_item) { on_removed_roster_item(account, jid, roster_item); ListRow row = new ListRow.from_jid(stream_interactor, new Jid(roster_item.jid), account); - rows[jid] = row; + rows[account][jid] = row; add(row); invalidate_sort(); invalidate_filter(); diff --git a/main/src/ui/add_conversation/conference/conference_list.vala b/main/src/ui/add_conversation/conference/conference_list.vala index d11271d8..ac74fa3a 100644 --- a/main/src/ui/add_conversation/conference/conference_list.vala +++ b/main/src/ui/add_conversation/conference/conference_list.vala @@ -11,7 +11,7 @@ protected class ConferenceList : FilterableList { public signal void conversation_selected(Conversation? conversation); private StreamInteractor stream_interactor; - private HashMap<Account, ArrayList<Xep.Bookmarks.Conference>> lists = new HashMap<Account, ArrayList<Xep.Bookmarks.Conference>>(); + private HashMap<Account, Gee.List<Xep.Bookmarks.Conference>> lists = new HashMap<Account, Gee.List<Xep.Bookmarks.Conference>>(); public ConferenceList(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; @@ -42,7 +42,7 @@ protected class ConferenceList : FilterableList { } } - private static void on_conference_bookmarks_received(Core.XmppStream stream, ArrayList<Xep.Bookmarks.Conference> conferences, Object? o) { + private static void on_conference_bookmarks_received(Core.XmppStream stream, Gee.List<Xep.Bookmarks.Conference> conferences, Object? o) { Idle.add(() => { Tuple<ConferenceList, Account> tuple = o as Tuple<ConferenceList, Account>; ConferenceList list = tuple.a; @@ -89,13 +89,15 @@ internal class ConferenceListRow : ListRow { this.account = account; this.bookmark = bookmark; - if (bookmark.name != "" && bookmark.name != bookmark.jid) { - name_label.label = bookmark.name; + name_label.label = bookmark.name ?? bookmark.jid; + if (stream_interactor.get_accounts().size > 1) { + via_label.label = "via " + account.bare_jid.to_string(); + } else if (bookmark.name != null && bookmark.name != bookmark.jid) { via_label.label = bookmark.jid; } else { - name_label.label = bookmark.jid; via_label.visible = false; } + image.set_from_pixbuf((new AvatarGenerator(35, 35)).set_stateless(true).draw_jid(stream_interactor, jid, account)); } } diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala index 2e7e321a..bb31b90d 100644 --- a/main/src/ui/conversation_selector/conversation_row.vala +++ b/main/src/ui/conversation_selector/conversation_row.vala @@ -12,7 +12,6 @@ namespace Dino.Ui.ConversationSelector { public abstract class ConversationRow : ListBoxRow { public signal void closed(); - public signal void disappeared(); [GtkChild] protected Image image; [GtkChild] private Label name_label; @@ -149,7 +148,6 @@ public abstract class ConversationRow : ListBoxRow { closed(); main_revealer.notify["child-revealed"].connect(() => { stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation); - disappeared(); }); } diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala index 3d6ee895..0e0ce554 100644 --- a/main/src/ui/conversation_selector/list.vala +++ b/main/src/ui/conversation_selector/list.vala @@ -23,19 +23,22 @@ public class List : ListBox { set_sort_func(sort); stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_read.connect((conversation) => { - Idle.add(() => {if (rows.has_key(conversation)) rows[conversation].mark_read(); return false;}); + Idle.add(() => { if (rows.has_key(conversation)) rows[conversation].mark_read(); return false; }); }); stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_unread.connect((conversation) => { - Idle.add(() => {if (rows.has_key(conversation)) rows[conversation].mark_unread(); return false;}); + Idle.add(() => { if (rows.has_key(conversation)) rows[conversation].mark_unread(); return false; }); }); stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => { - Idle.add(() => {add_conversation(conversation); return false;}); + Idle.add(() => { add_conversation(conversation); return false; }); + }); + stream_interactor.get_module(ConversationManager.IDENTITY).conversation_deactivated.connect((conversation) => { + Idle.add(() => { remove_conversation(conversation); return false; }); }); stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect((message, conversation) => { - Idle.add(() => {on_message_received(message, conversation); return false;}); + Idle.add(() => { on_message_received(message, conversation); return false; }); }); stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect((message, conversation) => { - Idle.add(() => {on_message_received(message, conversation); return false;}); + Idle.add(() => { on_message_received(message, conversation); return false; }); }); stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((show, jid, account) => { Idle.add(() => { @@ -132,7 +135,6 @@ public class List : ListBox { rows[conversation] = row; add(row); row.closed.connect(() => { select_next_conversation(conversation); }); - row.disappeared.connect(() => { remove_conversation(conversation); }); row.main_revealer.set_reveal_child(true); } invalidate_sort(); @@ -156,6 +158,7 @@ public class List : ListBox { } private void remove_conversation(Conversation conversation) { + select_next_conversation(conversation); if (rows.has_key(conversation) && !conversation.active) { remove(rows[conversation]); rows.unset(conversation); diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala index 1c4474c7..7fd4640a 100644 --- a/main/src/ui/unified_window.vala +++ b/main/src/ui/unified_window.vala @@ -39,8 +39,12 @@ public class UnifiedWindow : Window { stream_interactor.account_added.connect((account) => { check_stack(true); }); stream_interactor.account_removed.connect((account) => { check_stack(); }); - stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => { check_stack(); }); - stream_interactor.get_module(ConversationManager.IDENTITY).conversation_deactivated.connect((conversation) => { check_stack(); }); + stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect( (conversation) => { + Idle.add( () => { check_stack(); return false; }); + }); + stream_interactor.get_module(ConversationManager.IDENTITY).conversation_deactivated.connect( (conversation) => { + Idle.add( () => { check_stack(); return false; }); + }); accounts_placeholder.primary_button.clicked.connect(() => { get_application().activate_action("accounts", null); }); conversations_placeholder.primary_button.clicked.connect(() => { get_application().activate_action("add_chat", null); }); conversations_placeholder.secondary_button.clicked.connect(() => { get_application().activate_action("add_conference", null); }); |