aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/chat_input
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-03-08 22:15:53 +0100
committerfiaxh <git@lightrise.org>2020-03-08 22:21:09 +0100
commited6eda129edd94e07f9cdf8d8446576d50460031 (patch)
tree73f2575c5423b6f6bef8e50cec4de86d0354cd82 /main/src/ui/chat_input
parentf099def5b659527475b22021f730bd085c83e60c (diff)
downloaddino-ed6eda129edd94e07f9cdf8d8446576d50460031.tar.gz
dino-ed6eda129edd94e07f9cdf8d8446576d50460031.zip
Update live whether encryption is possible in MUC (lock icon visible)
Diffstat (limited to 'main/src/ui/chat_input')
-rw-r--r--main/src/ui/chat_input/chat_input_controller.vala2
-rw-r--r--main/src/ui/chat_input/encryption_button.vala15
2 files changed, 12 insertions, 5 deletions
diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala
index 59a2abb4..f65da1e8 100644
--- a/main/src/ui/chat_input/chat_input_controller.vala
+++ b/main/src/ui/chat_input/chat_input_controller.vala
@@ -35,8 +35,6 @@ public class ChatInputController : Object {
stream_interactor.get_module(FileManager.IDENTITY).upload_available.connect(on_upload_available);
}
-
-
public void set_conversation(Conversation conversation) {
this.conversation = conversation;
diff --git a/main/src/ui/chat_input/encryption_button.vala b/main/src/ui/chat_input/encryption_button.vala
index 3544c252..859b7baa 100644
--- a/main/src/ui/chat_input/encryption_button.vala
+++ b/main/src/ui/chat_input/encryption_button.vala
@@ -28,6 +28,12 @@ public class EncryptionButton : MenuButton {
button_unencrypted = builder.get_object("button_unencrypted") as RadioButton;
button_unencrypted.toggled.connect(encryption_button_toggled);
+ stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, muc_jid) => {
+ if (conversation != null && conversation.account.equals(account) && conversation.counterpart.equals(muc_jid)) {
+ update_visibility();
+ }
+ });
+
Application app = GLib.Application.get_default() as Application;
foreach (var e in app.plugin_registry.encryption_list_entries) {
RadioButton btn = new RadioButton.with_label(button_unencrypted.get_group(), e.name);
@@ -79,13 +85,16 @@ public class EncryptionButton : MenuButton {
set_icon(conversation.encryption == Encryption.NONE ? "changes-allow-symbolic" : "changes-prevent-symbolic");
}
+ private void update_visibility() {
+ visible = !stream_interactor.get_module(MucManager.IDENTITY).is_public_room(conversation.account, conversation.counterpart) ||
+ conversation.encryption != Encryption.NONE;
+ }
+
public new void set_conversation(Conversation conversation) {
this.conversation = conversation;
update_encryption_menu_state();
update_encryption_menu_icon();
-
- visible = !stream_interactor.get_module(MucManager.IDENTITY).is_public_room(conversation.account, conversation.counterpart) ||
- conversation.encryption != Encryption.NONE;
+ update_visibility();
}
}