diff options
author | fiaxh <git@lightrise.org> | 2019-05-26 22:18:08 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-06-22 00:56:50 +0200 |
commit | 2fb51df8a217a8dc11e10c38e06851f7b6263a3f (patch) | |
tree | fc80b3218560e24dc79238b55a1dfe9652706b52 /main/src/ui/chat_input | |
parent | 68ab977287d30b942e7c1668052af015dd102d5b (diff) | |
download | dino-2fb51df8a217a8dc11e10c38e06851f7b6263a3f.tar.gz dino-2fb51df8a217a8dc11e10c38e06851f7b6263a3f.zip |
Hide encryption icon in public MUCs
Diffstat (limited to 'main/src/ui/chat_input')
-rw-r--r-- | main/src/ui/chat_input/encryption_button.vala | 8 | ||||
-rw-r--r-- | main/src/ui/chat_input/view.vala | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/main/src/ui/chat_input/encryption_button.vala b/main/src/ui/chat_input/encryption_button.vala index 439c8ebd..0a092db0 100644 --- a/main/src/ui/chat_input/encryption_button.vala +++ b/main/src/ui/chat_input/encryption_button.vala @@ -11,8 +11,11 @@ public class EncryptionButton : MenuButton { private RadioButton? button_unencrypted; private Map<RadioButton, Plugins.EncryptionListEntry> encryption_radios = new HashMap<RadioButton, Plugins.EncryptionListEntry>(); private string? current_icon; + private StreamInteractor stream_interactor; + + public EncryptionButton(StreamInteractor stream_interactor) { + this.stream_interactor = stream_interactor; - public EncryptionButton() { relief = ReliefStyle.NONE; use_popover = true; image = new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON); @@ -72,6 +75,9 @@ public class EncryptionButton : MenuButton { 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; } } diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala index ddf1b3c0..cefe3fb1 100644 --- a/main/src/ui/chat_input/view.vala +++ b/main/src/ui/chat_input/view.vala @@ -30,7 +30,7 @@ public class View : Box { [GtkChild] private Box outer_box; [GtkChild] private Button file_button; [GtkChild] private Separator file_separator; - private EncryptionButton encryption_widget = new EncryptionButton() { margin_top=3, valign=Align.START, visible=true }; + private EncryptionButton encryption_widget; public View init(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; @@ -38,6 +38,7 @@ public class View : Box { occupants_tab_completor = new OccupantsTabCompletor(stream_interactor, text_input); smiley_converter = new SmileyConverter(stream_interactor, text_input); edit_history = new EditHistory(text_input, GLib.Application.get_default()); + encryption_widget = new EncryptionButton(stream_interactor) { margin_top=3, valign=Align.START, visible=true }; file_button.clicked.connect(() => { PreviewFileChooserNative chooser = new PreviewFileChooserNative("Select file", get_toplevel() as Gtk.Window, FileChooserAction.OPEN, "Select", "Cancel"); |