diff options
Diffstat (limited to 'main/src/ui/contact_details')
-rw-r--r-- | main/src/ui/contact_details/dialog.vala | 1 | ||||
-rw-r--r-- | main/src/ui/contact_details/permissions_provider.vala | 29 | ||||
-rw-r--r-- | main/src/ui/contact_details/settings_provider.vala | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/main/src/ui/contact_details/dialog.vala b/main/src/ui/contact_details/dialog.vala index ba9213a8..cf85e691 100644 --- a/main/src/ui/contact_details/dialog.vala +++ b/main/src/ui/contact_details/dialog.vala @@ -46,6 +46,7 @@ public class Dialog : Gtk.Dialog { app.plugin_registry.register_contact_details_entry(new SettingsProvider(stream_interactor)); app.plugin_registry.register_contact_details_entry(new BlockingProvider(stream_interactor)); app.plugin_registry.register_contact_details_entry(new MucConfigFormProvider(stream_interactor)); + app.plugin_registry.register_contact_details_entry(new PermissionsProvider(stream_interactor)); foreach (Plugins.ContactDetailsProvider provider in app.plugin_registry.contact_details_entries) { provider.populate(conversation, contact_details, Plugins.WidgetType.GTK); diff --git a/main/src/ui/contact_details/permissions_provider.vala b/main/src/ui/contact_details/permissions_provider.vala new file mode 100644 index 00000000..1a8649a8 --- /dev/null +++ b/main/src/ui/contact_details/permissions_provider.vala @@ -0,0 +1,29 @@ +using Gtk; + +using Dino.Entities; + +namespace Dino.Ui.ContactDetails { + +public class PermissionsProvider : Plugins.ContactDetailsProvider, Object { + public string id { get { return "permissions"; } } + + private StreamInteractor stream_interactor; + + public PermissionsProvider(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; + + Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account); + if (stream_interactor.get_module(MucManager.IDENTITY).get_role(own_jid, conversation.account)==Xmpp.Xep.Muc.Role.VISITOR){ + Button voice_request = new Button() {visible=true, label=_("Request")}; + voice_request.clicked.connect(()=>stream_interactor.get_module(MucManager.IDENTITY).request_voice(conversation.account, conversation.counterpart)); + contact_details.add(_("Permissions"), _("Request permission to send messages"), "", voice_request); + + } + } +} + +} diff --git a/main/src/ui/contact_details/settings_provider.vala b/main/src/ui/contact_details/settings_provider.vala index adc2e371..262029a2 100644 --- a/main/src/ui/contact_details/settings_provider.vala +++ b/main/src/ui/contact_details/settings_provider.vala @@ -45,6 +45,7 @@ public class SettingsProvider : Plugins.ContactDetailsProvider, Object { combobox.append("on", get_notify_setting_string(Conversation.NotifySetting.ON)); combobox.append("off", get_notify_setting_string(Conversation.NotifySetting.OFF)); 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); } ); } |