From d820c9029ad43f9315a47f58d1676dcc14f9d971 Mon Sep 17 00:00:00 2001 From: Miquel Lionel Date: Sun, 17 Sep 2023 13:14:43 +0200 Subject: Simplify talking to yourself (notes) on the UI - clicking on the menu will multiple accounts will bring up a modified "start chat" windows --- main/src/ui/add_conversation/roster_list.vala | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'main/src/ui/add_conversation/roster_list.vala') diff --git a/main/src/ui/add_conversation/roster_list.vala b/main/src/ui/add_conversation/roster_list.vala index bb338ce5..33e1e6da 100644 --- a/main/src/ui/add_conversation/roster_list.vala +++ b/main/src/ui/add_conversation/roster_list.vala @@ -16,7 +16,7 @@ protected class RosterList { private ListBox list_box = new ListBox(); private HashMap> rows = new HashMap>(Account.hash_func, Account.equals_func); - public RosterList(StreamInteractor stream_interactor, Gee.List accounts) { + public RosterList(StreamInteractor stream_interactor, Gee.List accounts, bool notes_mode = false) { this.stream_interactor = stream_interactor; this.accounts = accounts; @@ -34,7 +34,7 @@ protected class RosterList { foreach (ulong handler_id in handler_ids) stream_interactor.get_module(RosterManager.IDENTITY).disconnect(handler_id); }); - foreach (Account a in accounts) fetch_roster_items(a); + foreach (Account a in accounts) fetch_roster_items(a, notes_mode); } private void on_removed_roster_item(Account account, Jid jid, Roster.Item roster_item) { @@ -54,10 +54,17 @@ protected class RosterList { list_box.invalidate_filter(); } - private void fetch_roster_items(Account account) { - rows[account] = new HashMap(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, roster_item.jid, roster_item); + private void fetch_roster_items(Account account, bool notes_mode = false) { + if (notes_mode){ + ListRow own_account_row = new ListRow.from_jid(stream_interactor, account.bare_jid, account, accounts.size > 1); + ListBoxRow own_account_lbrow = new ListBoxRow() { child=own_account_row }; + list_box.append(own_account_lbrow); + } + else { + rows[account] = new HashMap(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, roster_item.jid, roster_item); + } } } -- cgit v1.2.3-54-g00ecf