From f40a34bdc1995e656b09cc1252a8dcce685e373f Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 11 Mar 2017 23:04:58 +0100 Subject: Use delegates + object storage instead of listener objects --- .../add_conversation/conference/conference_list.vala | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'libdino/src/ui/add_conversation/conference/conference_list.vala') diff --git a/libdino/src/ui/add_conversation/conference/conference_list.vala b/libdino/src/ui/add_conversation/conference/conference_list.vala index 17f08ff3..7743ced5 100644 --- a/libdino/src/ui/add_conversation/conference/conference_list.vala +++ b/libdino/src/ui/add_conversation/conference/conference_list.vala @@ -29,7 +29,7 @@ protected class ConferenceList : FilterableList { }); foreach (Account account in stream_interactor.get_accounts()) { - MucManager.get_instance(stream_interactor).get_bookmarks(account, new BookmarksListener(this, stream_interactor, account)); + MucManager.get_instance(stream_interactor).get_bookmarks(account, on_conference_bookmarks_received, Tuple.create(this, account)); } } @@ -42,18 +42,12 @@ protected class ConferenceList : FilterableList { } } - private class BookmarksListener : Xep.Bookmarks.ConferencesRetrieveResponseListener, Object { - ConferenceList outer; - Account account; - public BookmarksListener(ConferenceList outer, StreamInteractor stream_interactor, Account account) { - this.outer = outer; - this.account = account; - } - - public void on_result(Core.XmppStream stream, ArrayList conferences) { - outer.lists[account] = conferences; - Idle.add(() => { outer.refresh_conferences(); return false; }); - } + private static void on_conference_bookmarks_received(Core.XmppStream stream, ArrayList conferences, Object? o) { + Tuple tuple = o as Tuple; + ConferenceList list = tuple.a; + Account account = tuple.b; + list.lists[account] = conferences; + Idle.add(() => { list.refresh_conferences(); return false; }); } private void header(ListBoxRow row, ListBoxRow? before_row) { -- cgit v1.2.3-70-g09d2