aboutsummaryrefslogtreecommitdiff
path: root/main/src/windows
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2023-10-08 17:45:16 +0200
committerfiaxh <fiaxh@users.noreply.github.com>2024-08-19 11:36:17 +0200
commit8e7dedcaa62a49373c22dfc54bf1bb8b261bcb61 (patch)
tree822997b08d8cd1c2925650bf7203f928f9364c3c /main/src/windows
parentcfb0ca2a64c1d680799ce752412b089ac075b780 (diff)
downloaddino-8e7dedcaa62a49373c22dfc54bf1bb8b261bcb61.tar.gz
dino-8e7dedcaa62a49373c22dfc54bf1bb8b261bcb61.zip
Allow blocking entire domain from conversation details
- 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.vala19
1 files changed, 14 insertions, 5 deletions
diff --git a/main/src/windows/conversation_details.vala b/main/src/windows/conversation_details.vala
index 1dac02c7..b2b33fa3 100644
--- a/main/src/windows/conversation_details.vala
+++ b/main/src/windows/conversation_details.vala
@@ -11,7 +11,7 @@ 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 notification_button_toggle;
[GtkChild] public unowned Adw.ButtonContent notification_button_toggle_content;
@@ -27,16 +27,20 @@ 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("do.block", null, (widget, action_name) => { ((Dialog) widget).model.block_changed(ViewModel.ConversationDetails.BlockActions.USER); } );
+ install_action("do.block_domain", null, (widget, action_name) => { ((Dialog) widget).model.block_changed(ViewModel.ConversationDetails.BlockActions.DOMAIN); } );
+ install_action("do.unblock", null, (widget, action_name) => { ((Dialog) widget).model.block_changed(ViewModel.ConversationDetails.BlockActions.UNBLOCK); } );
}
construct {
pin_button.clicked.connect(() => { model.pin_changed(); });
- block_button.clicked.connect(() => { model.block_changed(); });
+ block_button.clicked.connect(() => { model.block_changed(ViewModel.ConversationDetails.BlockActions.TOGGLE); });
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);
@@ -64,13 +68,18 @@ 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");
if (model.blocked) {
+ block_button_content.label = _("Blocked");
block_button.add_css_class("error");
} else {
+ block_button_content.label = _("Block");
block_button.remove_css_class("error");
}
+
+ if (model.domain_blocked) {
+ block_button_content.label = _("Domain blocked");
+ block_button.add_css_class("error");
+ }
}
private void update_notification_button() {
@@ -229,4 +238,4 @@ namespace Dino.Ui.ConversationDetails {
return preference_group;
}
}
-} \ No newline at end of file
+}