From 782ae4c049e2b6fab13d7453cbb0e74610e7d200 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Fri, 12 Jan 2018 21:03:09 +0100 Subject: Move Jid class to xmpp-vala, partially refactor namespace --- main/src/ui/chat_input/encryption_button.vala | 14 +++++++++----- main/src/ui/chat_input/occupants_tab_completer.vala | 1 + main/src/ui/chat_input/view.vala | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'main/src/ui/chat_input') diff --git a/main/src/ui/chat_input/encryption_button.vala b/main/src/ui/chat_input/encryption_button.vala index 5fdcdaf7..439c8ebd 100644 --- a/main/src/ui/chat_input/encryption_button.vala +++ b/main/src/ui/chat_input/encryption_button.vala @@ -10,6 +10,7 @@ public class EncryptionButton : MenuButton { private Conversation? conversation; private RadioButton? button_unencrypted; private Map encryption_radios = new HashMap(); + private string? current_icon; public EncryptionButton() { relief = ReliefStyle.NONE; @@ -56,14 +57,17 @@ public class EncryptionButton : MenuButton { } } - private void update_encryption_menu_icon() { - if (conversation.encryption == Encryption.NONE) { - set_image(new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON)); - } else { - set_image(new Image.from_icon_name("changes-prevent-symbolic", IconSize.BUTTON)); + private void set_icon(string icon) { + if (icon != current_icon) { + image = new Image.from_icon_name(icon, IconSize.BUTTON); + current_icon = icon; } } + private void update_encryption_menu_icon() { + set_icon(conversation.encryption == Encryption.NONE ? "changes-allow-symbolic" : "changes-prevent-symbolic"); + } + public new void set_conversation(Conversation conversation) { this.conversation = conversation; update_encryption_menu_state(); diff --git a/main/src/ui/chat_input/occupants_tab_completer.vala b/main/src/ui/chat_input/occupants_tab_completer.vala index 2f35bf0d..b9f5cd45 100644 --- a/main/src/ui/chat_input/occupants_tab_completer.vala +++ b/main/src/ui/chat_input/occupants_tab_completer.vala @@ -3,6 +3,7 @@ using Gee; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui.ChatInput { diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala index 007e5379..ec551647 100644 --- a/main/src/ui/chat_input/view.vala +++ b/main/src/ui/chat_input/view.vala @@ -84,8 +84,8 @@ public class View : Box { stream_interactor.get_module(MucManager.IDENTITY).change_nick(conversation.account, conversation.counterpart, token[1]); return; case "/ping": - Xmpp.Core.XmppStream? stream = stream_interactor.get_stream(conversation.account); - stream.get_module(Xmpp.Xep.Ping.Module.IDENTITY).send_ping(stream, conversation.counterpart.to_string() + "/" + token[1], null); + Xmpp.XmppStream? stream = stream_interactor.get_stream(conversation.account); + stream.get_module(Xmpp.Xep.Ping.Module.IDENTITY).send_ping(stream, conversation.counterpart.with_resource(token[1]), null); return; case "/topic": stream_interactor.get_module(MucManager.IDENTITY).change_subject(conversation.account, conversation.counterpart, token[1]); -- cgit v1.2.3-54-g00ecf