From d3c6e5c62cb405cb6db646ee1ee03ca1e51d5e00 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 12 May 2019 00:09:50 +0200 Subject: Enable sending chat state notifications in private rooms --- main/src/ui/contact_details/settings_provider.vala | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'main/src') diff --git a/main/src/ui/contact_details/settings_provider.vala b/main/src/ui/contact_details/settings_provider.vala index 2f5d31a0..aa397814 100644 --- a/main/src/ui/contact_details/settings_provider.vala +++ b/main/src/ui/contact_details/settings_provider.vala @@ -9,25 +9,33 @@ public class SettingsProvider : Plugins.ContactDetailsProvider, Object { private StreamInteractor stream_interactor; + private string DETAILS_HEADLINE_CHAT = _("Settings"); + private string DETAILS_HEADLINE_ROOM = _("Local Settings"); + public SettingsProvider(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; } public void populate(Conversation conversation, Plugins.ContactDetails contact_details, Plugins.WidgetType type) { if (type != Plugins.WidgetType.GTK) return; - if (conversation.type_ == Conversation.Type.CHAT) { + + if (!stream_interactor.get_module(MucManager.IDENTITY).is_public_room(conversation.account, conversation.counterpart)) { + string details_headline = conversation.type_ == Conversation.Type.GROUPCHAT ? DETAILS_HEADLINE_ROOM : DETAILS_HEADLINE_CHAT; + ComboBoxText combobox_typing = get_combobox(Dino.Application.get_default().settings.send_typing); combobox_typing.active_id = get_setting_id(conversation.send_typing); combobox_typing.changed.connect(() => { conversation.send_typing = get_setting(combobox_typing.active_id); } ); - contact_details.add(_("Settings"), _("Send typing notifications"), "", combobox_typing); + contact_details.add(details_headline, _("Send typing notifications"), "", combobox_typing); + } + if (conversation.type_ == Conversation.Type.CHAT) { ComboBoxText combobox_marker = get_combobox(Dino.Application.get_default().settings.send_marker); - contact_details.add(_("Settings"), _("Send read receipts"), "", combobox_marker); + contact_details.add(DETAILS_HEADLINE_CHAT, _("Send read receipts"), "", combobox_marker); combobox_marker.active_id = get_setting_id(conversation.send_marker); combobox_marker.changed.connect(() => { conversation.send_marker = get_setting(combobox_marker.active_id); } ); ComboBoxText combobox_notifications = get_combobox(Dino.Application.get_default().settings.notifications); - contact_details.add(_("Settings"), _("Notifications"), "", combobox_notifications); + contact_details.add(DETAILS_HEADLINE_CHAT, _("Notifications"), "", combobox_notifications); combobox_notifications.active_id = get_notify_setting_id(conversation.notify_setting); combobox_notifications.changed.connect(() => { conversation.notify_setting = get_notify_setting(combobox_notifications.active_id); } ); } else if (conversation.type_ == Conversation.Type.GROUPCHAT) { @@ -36,7 +44,7 @@ public class SettingsProvider : Plugins.ContactDetailsProvider, Object { combobox.append("highlight", get_notify_setting_string(Conversation.NotifySetting.HIGHLIGHT)); combobox.append("on", get_notify_setting_string(Conversation.NotifySetting.ON)); combobox.append("off", get_notify_setting_string(Conversation.NotifySetting.OFF)); - contact_details.add(_("Local Settings"), _("Notifications"), "", combobox); + contact_details.add(DETAILS_HEADLINE_ROOM, _("Notifications"), "", combobox); combobox.active_id = get_notify_setting_id(conversation.notify_setting); combobox.changed.connect(() => { conversation.notify_setting = get_notify_setting(combobox.active_id); } ); } -- cgit v1.2.3-70-g09d2