diff options
author | fiaxh <git@lightrise.org> | 2021-11-04 17:35:11 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2021-11-10 11:05:34 +0100 |
commit | 3dc4d7f1558bb574eb99dade9a05727604e2e2ca (patch) | |
tree | a936dede1f2f41a27d7931ee7f668ef85deaa93b /main/src/ui/conversation_titlebar | |
parent | 26d10d1dcb95f11b65611473c9840e13683cb5ec (diff) | |
download | dino-3dc4d7f1558bb574eb99dade9a05727604e2e2ca.tar.gz dino-3dc4d7f1558bb574eb99dade9a05727604e2e2ca.zip |
Add (disabled) multi-party call UI
Diffstat (limited to 'main/src/ui/conversation_titlebar')
-rw-r--r-- | main/src/ui/conversation_titlebar/call_entry.vala | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/main/src/ui/conversation_titlebar/call_entry.vala b/main/src/ui/conversation_titlebar/call_entry.vala index 4bf946d2..3b3a5b39 100644 --- a/main/src/ui/conversation_titlebar/call_entry.vala +++ b/main/src/ui/conversation_titlebar/call_entry.vala @@ -47,16 +47,16 @@ namespace Dino.Ui { Box box = new Box(Orientation.VERTICAL, 0) { margin=10, visible=true }; audio_button.clicked.connect(() => { stream_interactor.get_module(Calls.IDENTITY).initiate_call.begin(conversation, false, (_, res) => { - Call call = stream_interactor.get_module(Calls.IDENTITY).initiate_call.end(res); - open_call_window(call); + CallState call_state = stream_interactor.get_module(Calls.IDENTITY).initiate_call.end(res); + open_call_window(call_state); }); }); box.add(audio_button); video_button.clicked.connect(() => { stream_interactor.get_module(Calls.IDENTITY).initiate_call.begin(conversation, true, (_, res) => { - Call call = stream_interactor.get_module(Calls.IDENTITY).initiate_call.end(res); - open_call_window(call); + CallState call_state = stream_interactor.get_module(Calls.IDENTITY).initiate_call.end(res); + open_call_window(call_state); }); }); box.add(video_button); @@ -68,7 +68,7 @@ namespace Dino.Ui { popover_menu.visible = true; }); - stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect((call, conversation) => { + stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect((call, state,conversation) => { update_button_state(); }); @@ -76,6 +76,7 @@ namespace Dino.Ui { update_button_state(); }); stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((jid, account) => { + if (this.conversation == null) return; if (this.conversation.counterpart.equals_bare(jid) && this.conversation.account.equals(account)) { update_visibility.begin(); } @@ -83,11 +84,14 @@ namespace Dino.Ui { stream_interactor.connection_manager.connection_state_changed.connect((account, state) => { update_visibility.begin(); }); + Dino.Application.get_default().plugin_registry.video_call_plugin.devices_changed.connect((media, incoming) => { + update_visibility.begin(); + }); } - private void open_call_window(Call call) { + private void open_call_window(CallState call_state) { var call_window = new CallWindow(); - var call_controller = new CallWindowController(call_window, call, stream_interactor); + var call_controller = new CallWindowController(call_window, call_state, stream_interactor); call_window.controller = call_controller; call_window.present(); @@ -102,17 +106,15 @@ namespace Dino.Ui { } private void update_button_state() { - Jid? call_counterpart = stream_interactor.get_module(Calls.IDENTITY).is_call_in_progress(); - this.sensitive = call_counterpart == null; - - if (call_counterpart != null && call_counterpart.equals_bare(conversation.counterpart)) { - this.set_image(new Gtk.Image.from_icon_name("dino-phone-in-talk-symbolic", Gtk.IconSize.MENU) { visible=true }); - } else { - this.set_image(new Gtk.Image.from_icon_name("dino-phone-symbolic", Gtk.IconSize.MENU) { visible=true }); - } + this.sensitive = !stream_interactor.get_module(Calls.IDENTITY).is_call_in_progress(); } private async void update_visibility() { + if (conversation == null) { + visible = false; + return; + } + if (conversation.type_ == Conversation.Type.CHAT) { Conversation conv_bak = conversation; bool audio_works = yield stream_interactor.get_module(Calls.IDENTITY).can_do_audio_calls_async(conversation); |