From 3dc4d7f1558bb574eb99dade9a05727604e2e2ca Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 4 Nov 2021 17:35:11 +0100 Subject: Add (disabled) multi-party call UI --- main/src/ui/call_window/call_encryption_button.vala | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'main/src/ui/call_window/call_encryption_button.vala') diff --git a/main/src/ui/call_window/call_encryption_button.vala b/main/src/ui/call_window/call_encryption_button.vala index 1d785d51..a7081954 100644 --- a/main/src/ui/call_window/call_encryption_button.vala +++ b/main/src/ui/call_window/call_encryption_button.vala @@ -2,19 +2,21 @@ using Dino.Entities; using Gtk; using Pango; -public class Dino.Ui.CallEntryptionButton : MenuButton { +public class Dino.Ui.CallEncryptionButton : MenuButton { - private Image encryption_image = new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON) { visible=true }; + private Image encryption_image = new Image.from_icon_name("", IconSize.BUTTON) { visible=true }; + private bool has_been_set = false; + public bool controls_active { get; set; default=false; } - construct { + public CallEncryptionButton() { + this.opacity = 0; add(encryption_image); - get_style_context().add_class("encryption-box"); this.set_popover(popover); + + this.notify["controls-active"].connect(update_opacity); } public void set_icon(bool encrypted, string? icon_name) { - this.visible = true; - if (encrypted) { encryption_image.set_from_icon_name(icon_name ?? "changes-prevent-symbolic", IconSize.BUTTON); get_style_context().remove_class("unencrypted"); @@ -22,6 +24,8 @@ public class Dino.Ui.CallEntryptionButton : MenuButton { encryption_image.set_from_icon_name(icon_name ?? "changes-allow-symbolic", IconSize.BUTTON); get_style_context().add_class("unencrypted"); } + has_been_set = true; + update_opacity(); } public void set_info(string? title, bool show_keys, Xmpp.Xep.Jingle.ContentEncryption? audio_encryption, Xmpp.Xep.Jingle.ContentEncryption? video_encryption) { @@ -51,6 +55,10 @@ public class Dino.Ui.CallEntryptionButton : MenuButton { popover.add(box); } + public void update_opacity() { + this.opacity = controls_active && has_been_set ? 1 : 0; + } + private Grid create_media_encryption_grid(Xmpp.Xep.Jingle.ContentEncryption? encryption) { Grid ret = new Grid() { row_spacing=3, column_spacing=5, visible=true }; if (encryption.peer_key.length > 0) { -- cgit v1.2.3-54-g00ecf