diff options
author | fiaxh <git@lightrise.org> | 2020-03-08 22:15:53 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-03-08 22:21:09 +0100 |
commit | ed6eda129edd94e07f9cdf8d8446576d50460031 (patch) | |
tree | 73f2575c5423b6f6bef8e50cec4de86d0354cd82 /main/src | |
parent | f099def5b659527475b22021f730bd085c83e60c (diff) | |
download | dino-ed6eda129edd94e07f9cdf8d8446576d50460031.tar.gz dino-ed6eda129edd94e07f9cdf8d8446576d50460031.zip |
Update live whether encryption is possible in MUC (lock icon visible)
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/ui/avatar_image.vala | 7 | ||||
-rw-r--r-- | main/src/ui/chat_input/chat_input_controller.vala | 2 | ||||
-rw-r--r-- | main/src/ui/chat_input/encryption_button.vala | 15 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/conversation_selector_row.vala | 2 | ||||
-rw-r--r-- | main/src/ui/conversation_view_controller.vala | 2 |
5 files changed, 21 insertions, 7 deletions
diff --git a/main/src/ui/avatar_image.vala b/main/src/ui/avatar_image.vala index a3b386e3..ab64f5b9 100644 --- a/main/src/ui/avatar_image.vala +++ b/main/src/ui/avatar_image.vala @@ -83,6 +83,7 @@ public class AvatarImage : Misc { stream_interactor.connection_manager.connection_state_changed.disconnect(on_connection_changed); stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.disconnect(on_roster_updated); muc_manager.private_room_occupant_updated.disconnect(on_private_room_occupant_updated); + muc_manager.room_info_updated.disconnect(on_room_info_updated); stream_interactor = null; } } @@ -125,6 +126,11 @@ public class AvatarImage : Misc { update_avatar_if_jid(room); } + private void on_room_info_updated(Account account, Jid muc_jid) { + if (!account.equals(this.account)) return; + update_avatar_if_jid(muc_jid); + } + private bool is_self_online() { if (connection_manager != null) { return connection_manager.get_state(account) == ConnectionManager.ConnectionState.CONNECTED; @@ -167,6 +173,7 @@ public class AvatarImage : Misc { stream_interactor.connection_manager.connection_state_changed.connect(on_connection_changed); stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect(on_roster_updated); muc_manager.private_room_occupant_updated.connect(on_private_room_occupant_updated); + muc_manager.room_info_updated.connect(on_room_info_updated); } this.cached_surface = null; this.conversation = conversation; 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(); } } diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala index 7b017258..80257a6d 100644 --- a/main/src/ui/conversation_selector/conversation_selector_row.vala +++ b/main/src/ui/conversation_selector/conversation_selector_row.vala @@ -49,7 +49,7 @@ public class ConversationSelectorRow : ListBoxRow { }); break; case Conversation.Type.GROUPCHAT: - stream_interactor.get_module(MucManager.IDENTITY).room_name_set.connect((account, jid, room_name) => { + stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, jid) => { if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) { update_name_label(); } diff --git a/main/src/ui/conversation_view_controller.vala b/main/src/ui/conversation_view_controller.vala index cb5d4dce..abb8ab57 100644 --- a/main/src/ui/conversation_view_controller.vala +++ b/main/src/ui/conversation_view_controller.vala @@ -61,7 +61,7 @@ public class ConversationViewController : Object { // Update conversation display name & topic this.bind_property("conversation-display-name", titlebar, "title"); this.bind_property("conversation-topic", titlebar, "subtitle"); - stream_interactor.get_module(MucManager.IDENTITY).room_name_set.connect((account, jid, room_name) => { + stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, jid) => { if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) { update_conversation_display_name(); } |