aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/occupant_menu
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-10-12 16:23:25 +0200
committerfiaxh <git@lightrise.org>2021-10-12 19:43:57 +0200
commitbea85c8ab5f74d96f37c1b3a6ea1e83edd0de500 (patch)
tree973d1211daa374679d87c27312b4d1d671fe7944 /main/src/ui/occupant_menu
parent76e425ed2705349b201444e78719896419862b00 (diff)
downloaddino-bea85c8ab5f74d96f37c1b3a6ea1e83edd0de500.tar.gz
dino-bea85c8ab5f74d96f37c1b3a6ea1e83edd0de500.zip
Fix compiler warnings ('cast between incompatible function types') by not connecting closures
Diffstat (limited to 'main/src/ui/occupant_menu')
-rw-r--r--main/src/ui/occupant_menu/view.vala59
1 files changed, 31 insertions, 28 deletions
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index 4675dca4..ebad6f09 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -11,8 +11,9 @@ public class View : Popover {
private Conversation conversation;
private Stack stack = new Stack() { vhomogeneous=false, visible=true };
+ private Box list_box = new Box(Orientation.VERTICAL, 1) { visible=true };
private List? list = null;
- private ListBox invite_list;
+ private ListBox invite_list = new ListBox() { visible=true };
private Box? jid_menu = null;
private Jid? selected_jid;
@@ -21,37 +22,12 @@ public class View : Popover {
this.stream_interactor = stream_interactor;
this.conversation = conversation;
- Box list_box = new Box(Orientation.VERTICAL, 1) { visible=true };
- this.show.connect(() => {
- if (list == null) {
- list = new List(stream_interactor, conversation) { visible=true };
- list_box.add(list);
- list_box.reorder_child(list, 0);
+ this.show.connect(initialize_list);
- list.list_box.row_activated.connect((row) => {
- ListRow list_row = row as ListRow;
- show_menu(list_row.jid, list_row.name_label.label);
- });
- }
- });
-
- invite_list = new ListBox() { visible=true };
invite_list.add(new ListRow.label("+", _("Invite")) {visible=true});
list_box.add(invite_list);
- invite_list.row_activated.connect((row) => {
- hide();
- Gee.List<Account> acc_list = new ArrayList<Account>(Account.equals_func);
- acc_list.add(conversation.account);
- SelectContactDialog add_chat_dialog = new SelectContactDialog(stream_interactor, acc_list);
- add_chat_dialog.set_transient_for((Window) get_toplevel());
- add_chat_dialog.title = _("Invite to Conference");
- add_chat_dialog.ok_button.label = _("Invite");
- add_chat_dialog.selected.connect((account, jid) => {
- stream_interactor.get_module(MucManager.IDENTITY).invite(conversation.account, conversation.counterpart, jid);
- });
- add_chat_dialog.present();
- });
+ invite_list.row_activated.connect(on_invite_clicked);
stack.add_named(list_box, "list");
add(stack);
@@ -67,6 +43,19 @@ public class View : Popover {
invite_list.unselect_all();
}
+ private void initialize_list() {
+ if (list == null) {
+ list = new List(stream_interactor, conversation) { visible=true };
+ list_box.add(list);
+ list_box.reorder_child(list, 0);
+
+ list.list_box.row_activated.connect((row) => {
+ ListRow list_row = row as ListRow;
+ show_menu(list_row.jid, list_row.name_label.label);
+ });
+ }
+ }
+
private void show_list() {
if (list != null) list.list_box.unselect_all();
stack.transition_type = StackTransitionType.SLIDE_RIGHT;
@@ -146,6 +135,20 @@ public class View : Popover {
stream_interactor.get_module(MucManager.IDENTITY).change_role(conversation.account, conversation.counterpart, selected_jid.resourcepart, role);
}
+
+ private void on_invite_clicked() {
+ hide();
+ Gee.List<Account> acc_list = new ArrayList<Account>(Account.equals_func);
+ acc_list.add(conversation.account);
+ SelectContactDialog add_chat_dialog = new SelectContactDialog(stream_interactor, acc_list);
+ add_chat_dialog.set_transient_for((Window) get_toplevel());
+ add_chat_dialog.title = _("Invite to Conference");
+ add_chat_dialog.ok_button.label = _("Invite");
+ add_chat_dialog.selected.connect((account, jid) => {
+ stream_interactor.get_module(MucManager.IDENTITY).invite(conversation.account, conversation.counterpart, jid);
+ });
+ add_chat_dialog.present();
+ }
}
}