aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/ui/add_conversation/conference
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-11 23:04:58 +0100
committerfiaxh <git@mx.ax.lt>2017-03-11 23:09:57 +0100
commitf40a34bdc1995e656b09cc1252a8dcce685e373f (patch)
treed56684122d0a2f0e13ee9d94e6e8675bae1b4c52 /libdino/src/ui/add_conversation/conference
parent0ea4ac7e20674e3e6a8d1b3d4b53702dace72907 (diff)
downloaddino-f40a34bdc1995e656b09cc1252a8dcce685e373f.tar.gz
dino-f40a34bdc1995e656b09cc1252a8dcce685e373f.zip
Use delegates + object storage instead of listener objects
Diffstat (limited to 'libdino/src/ui/add_conversation/conference')
-rw-r--r--libdino/src/ui/add_conversation/conference/conference_list.vala20
1 files changed, 7 insertions, 13 deletions
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<Xep.Bookmarks.Conference> conferences) {
- outer.lists[account] = conferences;
- Idle.add(() => { outer.refresh_conferences(); return false; });
- }
+ private static void on_conference_bookmarks_received(Core.XmppStream stream, ArrayList<Xep.Bookmarks.Conference> conferences, Object? o) {
+ Tuple<ConferenceList, Account> tuple = o as Tuple<ConferenceList, Account>;
+ 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) {