diff options
author | Miquel Lionel <lionel@les-miquelots.net> | 2023-10-08 17:45:16 +0200 |
---|---|---|
committer | Miquel Lionel <lionel@les-miquelots.net> | 2024-06-22 00:29:45 +0200 |
commit | 01a547ef18a52064cc85d1050c60f37bb50bd028 (patch) | |
tree | ece37e86cdefe6a149277f9a5e0c37625231520d /main/src/windows | |
parent | 8b15417e0f6e90ef510ee70df7d32dbb7ce79393 (diff) | |
download | dino-allow-blocking-entire-domain.tar.gz dino-allow-blocking-entire-domain.zip |
Allow blocking entire domain from conversation detailsallow-blocking-entire-domain
- the block domain option is in a drop down of the block button
- when blocking the domain, the "Blocked domain" button appears
and block button disappears and vice versa.
Diffstat (limited to 'main/src/windows')
-rw-r--r-- | main/src/windows/conversation_details.vala | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/main/src/windows/conversation_details.vala b/main/src/windows/conversation_details.vala index 1dac02c7..02463cbc 100644 --- a/main/src/windows/conversation_details.vala +++ b/main/src/windows/conversation_details.vala @@ -11,8 +11,10 @@ namespace Dino.Ui.ConversationDetails { [GtkChild] public unowned Box about_box; [GtkChild] public unowned Button pin_button; [GtkChild] public unowned Adw.ButtonContent pin_button_content; - [GtkChild] public unowned Button block_button; + [GtkChild] public unowned Adw.SplitButton block_button; [GtkChild] public unowned Adw.ButtonContent block_button_content; + [GtkChild] public unowned Button block_domain_button; + [GtkChild] public unowned Adw.ButtonContent block_domain_button_content; [GtkChild] public unowned Button notification_button_toggle; [GtkChild] public unowned Adw.ButtonContent notification_button_toggle_content; [GtkChild] public unowned MenuButton notification_button_menu; @@ -27,16 +29,19 @@ namespace Dino.Ui.ConversationDetails { install_action("notification.off", null, (widget, action_name) => { ((Dialog) widget).model.notification_changed(ViewModel.ConversationDetails.NotificationSetting.OFF); } ); install_action("notification.highlight", null, (widget, action_name) => { ((Dialog) widget).model.notification_changed(ViewModel.ConversationDetails.NotificationSetting.HIGHLIGHT); } ); install_action("notification.default", null, (widget, action_name) => { ((Dialog) widget).model.notification_changed(ViewModel.ConversationDetails.NotificationSetting.DEFAULT); } ); + install_action("domain.on", null, (widget, action_name) => { ((Dialog) widget).model.domain_block_changed(); } ); } construct { pin_button.clicked.connect(() => { model.pin_changed(); }); block_button.clicked.connect(() => { model.block_changed(); }); + block_domain_button.clicked.connect(() => { model.domain_block_changed(); }); notification_button_toggle.clicked.connect(() => { model.notification_flipped(); }); notification_button_split.clicked.connect(() => { model.notification_flipped(); }); model.notify["pinned"].connect(update_pinned_button); model.notify["blocked"].connect(update_blocked_button); + model.notify["domain-blocked"].connect(update_blocked_button); model.notify["notification"].connect(update_notification_button); model.notify["notification"].connect(update_notification_button_state); model.notify["notification-options"].connect(update_notification_button_visibility); @@ -66,11 +71,23 @@ namespace Dino.Ui.ConversationDetails { private void update_blocked_button() { block_button_content.icon_name = "dino-block-symbolic"; block_button_content.label = model.blocked ? _("Blocked") : _("Block"); + block_domain_button_content.label = model.domain_blocked ? _("Domain blocked") : _("Block domain"); + block_domain_button.visible = false; if (model.blocked) { + block_button.visible = true; + block_domain_button.visible = false; block_button.add_css_class("error"); } else { block_button.remove_css_class("error"); } + + if (model.domain_blocked) { + block_domain_button.visible = true; + block_button.visible = false; + block_domain_button.add_css_class("error"); + } else { + block_button.visible = true; + } } private void update_notification_button() { @@ -229,4 +246,4 @@ namespace Dino.Ui.ConversationDetails { return preference_group; } } -}
\ No newline at end of file +} |