diff options
author | fiaxh <git@lightrise.org> | 2022-02-14 14:55:59 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-07-27 20:34:20 +0200 |
commit | 7e7dcedaf31ee35499875491c9f569c575d28435 (patch) | |
tree | 0c5fee2b28baf320775fbc92b3c252e97d9d054f /main/src/ui/add_conversation/roster_list.vala | |
parent | f25bfb00969a7e09996da2d5500e6718f4cc0148 (diff) | |
download | dino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip |
Port from GTK3 to GTK4
Diffstat (limited to 'main/src/ui/add_conversation/roster_list.vala')
-rw-r--r-- | main/src/ui/add_conversation/roster_list.vala | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/main/src/ui/add_conversation/roster_list.vala b/main/src/ui/add_conversation/roster_list.vala index fd4d4ade..a89d24e8 100644 --- a/main/src/ui/add_conversation/roster_list.vala +++ b/main/src/ui/add_conversation/roster_list.vala @@ -6,22 +6,23 @@ using Xmpp; namespace Dino.Ui { -protected class RosterList : FilterableList { +protected class RosterList { public signal void conversation_selected(Conversation? conversation); private StreamInteractor stream_interactor; private Gee.List<Account> accounts; private ulong[] handler_ids = new ulong[0]; + private ListBox list_box = new ListBox(); private HashMap<Account, HashMap<Jid, ListRow>> rows = new HashMap<Account, HashMap<Jid, ListRow>>(Account.hash_func, Account.equals_func); public RosterList(StreamInteractor stream_interactor, Gee.List<Account> accounts) { this.stream_interactor = stream_interactor; this.accounts = accounts; - set_filter_func(filter); - set_header_func(header); - set_sort_func(sort); +// set_filter_func(filter); + list_box.set_header_func(header); +// set_sort_func(sort); handler_ids += stream_interactor.get_module(RosterManager.IDENTITY).removed_roster_item.connect( (account, jid, roster_item) => { if (accounts.contains(account)) { @@ -33,7 +34,7 @@ protected class RosterList : FilterableList { on_updated_roster_item(account, jid, roster_item); } }); - destroy.connect(() => { + list_box.destroy.connect(() => { foreach (ulong handler_id in handler_ids) stream_interactor.get_module(RosterManager.IDENTITY).disconnect(handler_id); }); @@ -42,7 +43,7 @@ protected class RosterList : FilterableList { private void on_removed_roster_item(Account account, Jid jid, Roster.Item roster_item) { if (rows.has_key(account) && rows[account].has_key(jid)) { - remove(rows[account][jid]); + list_box.remove(rows[account][jid]); rows[account].unset(jid); } } @@ -51,9 +52,9 @@ protected class RosterList : FilterableList { on_removed_roster_item(account, jid, roster_item); ListRow row = new ListRow.from_jid(stream_interactor, roster_item.jid, account, accounts.size > 1); rows[account][jid] = row; - add(row); - invalidate_sort(); - invalidate_filter(); + list_box.append(row); + list_box.invalidate_sort(); + list_box.invalidate_filter(); } private void fetch_roster_items(Account account) { @@ -69,25 +70,8 @@ protected class RosterList : FilterableList { } } - private bool filter(ListBoxRow r) { - if (r.get_type().is_a(typeof(ListRow))) { - ListRow row = r as ListRow; - if (filter_values != null) { - foreach (string filter in filter_values) { - if (!(row.name_label.label.down().contains(filter.down()) || - row.jid.to_string().down().contains(filter.down()))) { - return false; - } - } - } - } - return true; - } - - public override int sort(ListBoxRow row1, ListBoxRow row2) { - ListRow c1 = (row1 as ListRow); - ListRow c2 = (row2 as ListRow); - return c1.name_label.label.collate(c2.name_label.label); + public ListBox get_list_box() { + return list_box; } } |