[geary/gnumdk/fix_mark_menu_actions] client: Fix updating actions state in mark messages menu
- From: Cédric Bellegarde <cbellegarde src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/gnumdk/fix_mark_menu_actions] client: Fix updating actions state in mark messages menu
- Date: Sat, 16 Jul 2022 16:10:03 +0000 (UTC)
commit 8df2c81c15cee7cccd345412e16b6f89c3a0fe84
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date: Sat Jul 16 18:05:03 2022 +0200
client: Fix updating actions state in mark messages menu
src/client/application/application-main-window.vala | 12 ++++++------
src/client/components/components-conversation-actions.vala | 8 ++++++++
2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/client/application/application-main-window.vala
b/src/client/application/application-main-window.vala
index 8e969d108..0d56cbfbe 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -27,7 +27,6 @@ public class Application.MainWindow :
public const string ACTION_SEARCH = "search";
public const string ACTION_SELECT_INBOX = "select-inbox";
public const string ACTION_SHOW_COPY_MENU = "show-copy-menu";
- public const string ACTION_SHOW_MARK_MENU = "show-mark-menu";
public const string ACTION_SHOW_MOVE_MENU = "show-move-menu";
public const string ACTION_TOGGLE_JUNK = "toggle-conversation-junk";
public const string ACTION_TRASH_CONVERSATION = "trash-conversation";
@@ -61,7 +60,6 @@ public class Application.MainWindow :
{ ACTION_CONVERSATION_UP, on_conversation_up },
{ ACTION_CONVERSATION_DOWN, on_conversation_down },
// Message marking actions
- { ACTION_SHOW_MARK_MENU, on_show_mark_menu },
{ ACTION_MARK_AS_READ, on_mark_as_read },
{ ACTION_MARK_AS_UNREAD, on_mark_as_unread },
{ ACTION_MARK_AS_STARRED, on_mark_as_starred },
@@ -673,9 +671,15 @@ public class Application.MainWindow :
this.cert_problem_infobar.get_action_area().add(cert_retry);
this.conversation_list_view.grab_focus();
+
+ this.conversation_list_actions.mark_message_button_toggled.connect(on_show_mark_menu);
+ this.main_toolbar.full_actions.mark_message_button_toggled.connect(on_show_mark_menu);
}
~MainWindow() {
+ this.conversation_list_actions.mark_message_button_toggled.disconnect(on_show_mark_menu);
+ this.main_toolbar.full_actions.mark_message_button_toggled.connect(on_show_mark_menu);
+
base_unref();
}
@@ -1915,10 +1919,6 @@ public class Application.MainWindow :
supported_operations.add_all(selected_operations.get_values());
}
- get_window_action(ACTION_SHOW_MARK_MENU).set_enabled(
- sensitive &&
- (typeof(Geary.FolderSupport.Mark) in supported_operations)
- );
get_window_action(ACTION_SHOW_COPY_MENU).set_enabled(
sensitive &&
(supported_operations.contains(typeof(Geary.FolderSupport.Copy)))
diff --git a/src/client/components/components-conversation-actions.vala
b/src/client/components/components-conversation-actions.vala
index f7df39fb9..dcd78434c 100644
--- a/src/client/components/components-conversation-actions.vala
+++ b/src/client/components/components-conversation-actions.vala
@@ -60,6 +60,11 @@ public class Components.ConversationActions : Gtk.Box {
this.copy_message_button.popover = copy_folder_menu;
this.move_message_button.popover = move_folder_menu;
+ this.mark_message_button.toggled.connect((button) => {
+ if (button.active)
+ mark_message_button_toggled();
+ });
+
this.response_buttons.set_visible(this.show_response_actions);
this.mark_copy_move_buttons.set_visible(this.show_conversation_actions);
this.archive_trash_delete_buttons.set_visible(this.show_conversation_actions);
@@ -91,6 +96,9 @@ public class Components.ConversationActions : Gtk.Box {
update_conversation_buttons();
}
+ /** Fired when the user toggles the mark message button. */
+ public signal void mark_message_button_toggled();
+
/** Updates tooltip text depending on number of conversations selected. */
private void update_conversation_buttons() {
this.mark_message_button.tooltip_text = ngettext(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]