From 7bbbb738fdb233f4ad91ffdd7d9247b28849d715 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 13 Jun 2017 18:14:59 +0200 Subject: Get rid of manual storage objects for delegates --- .../ui/add_conversation/conference/conference_list.vala | 14 ++++++-------- main/src/ui/contact_details/muc_config_form_provider.vala | 13 +++++-------- 2 files changed, 11 insertions(+), 16 deletions(-) (limited to 'main/src') diff --git a/main/src/ui/add_conversation/conference/conference_list.vala b/main/src/ui/add_conversation/conference/conference_list.vala index ac74fa3a..1f4abfa3 100644 --- a/main/src/ui/add_conversation/conference/conference_list.vala +++ b/main/src/ui/add_conversation/conference/conference_list.vala @@ -29,7 +29,7 @@ protected class ConferenceList : FilterableList { }); foreach (Account account in stream_interactor.get_accounts()) { - stream_interactor.get_module(MucManager.IDENTITY).get_bookmarks(account, on_conference_bookmarks_received, Tuple.create(this, account)); + stream_interactor.get_module(MucManager.IDENTITY).get_bookmarks(account, (stream, conferences) => { on_conference_bookmarks_received(stream, account, conferences); }); } } @@ -42,13 +42,11 @@ protected class ConferenceList : FilterableList { } } - private static void on_conference_bookmarks_received(Core.XmppStream stream, Gee.List conferences, Object? o) { + private void on_conference_bookmarks_received(Core.XmppStream stream, Account account, Gee.List conferences) { Idle.add(() => { - Tuple tuple = o as Tuple; - ConferenceList list = tuple.a; - Account account = tuple.b; - list.lists[account] = conferences; - list.refresh_conferences(); return false; + lists[account] = conferences; + refresh_conferences(); + return false; }); } @@ -102,4 +100,4 @@ internal class ConferenceListRow : ListRow { } } -} \ No newline at end of file +} diff --git a/main/src/ui/contact_details/muc_config_form_provider.vala b/main/src/ui/contact_details/muc_config_form_provider.vala index 2986134a..41df4465 100644 --- a/main/src/ui/contact_details/muc_config_form_provider.vala +++ b/main/src/ui/contact_details/muc_config_form_provider.vala @@ -18,19 +18,16 @@ public class MucConfigFormProvider : Plugins.ContactDetailsProvider { if (conversation.type_ == Conversation.Type.GROUPCHAT) { Xmpp.Core.XmppStream? stream = stream_interactor.get_stream(conversation.account); if (stream == null) return; - stream_interactor.get_module(MucManager.IDENTITY).get_config_form(conversation.account, conversation.counterpart, (jid, data_form, store) => { - Plugins.ContactDetails contact_details_ = store as Plugins.ContactDetails; - contact_details_.save.connect(() => { - data_form.submit(); - }); + stream_interactor.get_module(MucManager.IDENTITY).get_config_form(conversation.account, conversation.counterpart, (jid, data_form) => { + contact_details.save.connect(() => { data_form.submit(); }); Idle.add(() => { for (int i = 0; i < data_form.fields.size; i++) { DataForms.DataForm.Field field = data_form.fields[i]; - add_field(field, contact_details_); + add_field(field, contact_details); } return false; }); - }, contact_details); + }); } } @@ -128,4 +125,4 @@ public class MucConfigFormProvider : Plugins.ContactDetailsProvider { } } -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2