[geary/gnumdk/stable: 15/21] client: Fix handling of 'mark messages' menu
- From: Cédric Bellegarde <cbellegarde src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/gnumdk/stable: 15/21] client: Fix handling of 'mark messages' menu
- Date: Mon, 1 Aug 2022 12:45:47 +0000 (UTC)
commit 0ec00e796a71fb11463ca350133852e95eab48e3
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date: Sat Jul 16 18:05:03 2022 +0200
client: Fix handling of 'mark messages' menu
- Replace unused show-mark-menu action
- Remove compact actions from conversation actions (not useful as only response
buttons are enabled)
- Do not update trash button for compact actions (same reason as above)
- Add missing this for accessing some properties (Geary Vala
Coding Conventions)
.../application/application-main-window.vala | 29 ++++++++++++----------
.../components-conversation-actions.vala | 12 +++++++++
2 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/src/client/application/application-main-window.vala
b/src/client/application/application-main-window.vala
index 8e969d108..681bfe3a5 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,6 +671,10 @@ public class Application.MainWindow :
this.cert_problem_infobar.get_action_area().add(cert_retry);
this.conversation_list_view.grab_focus();
+
+ foreach (var actions in this.folder_conversation_actions) {
+ actions.mark_message_button_toggled.connect(on_show_mark_menu);
+ }
}
~MainWindow() {
@@ -1399,10 +1401,9 @@ public class Application.MainWindow :
this.folder_conversation_actions = {
this.main_toolbar.full_actions,
- this.main_toolbar.compact_actions,
this.conversation_list_actions
};
- foreach (var actions in folder_conversation_actions) {
+ foreach (var actions in this.folder_conversation_actions) {
var move = actions.move_folder_menu;
this.folder_popovers += move;
move.folder_selected.connect(on_move_conversation);
@@ -1827,7 +1828,7 @@ public class Application.MainWindow :
get_window_action(ACTION_FORWARD_CONVERSATION).set_enabled(reply_sensitive);
bool move_enabled = (
- sensitive && (selected_folder is Geary.FolderSupport.Move)
+ sensitive && (this.selected_folder is Geary.FolderSupport.Move)
);
get_window_action(ACTION_SHOW_MOVE_MENU).set_enabled(move_enabled);
foreach (var actions in this.folder_conversation_actions) {
@@ -1835,21 +1836,28 @@ public class Application.MainWindow :
}
bool copy_enabled = (
- sensitive && (selected_folder is Geary.FolderSupport.Copy)
+ sensitive && (this.selected_folder is Geary.FolderSupport.Copy)
);
get_window_action(ACTION_SHOW_COPY_MENU).set_enabled(move_enabled);
foreach (var actions in this.folder_conversation_actions) {
actions.set_copy_sensitive(copy_enabled);
}
+ bool mark_enabled = (
+ sensitive && (this.selected_folder is Geary.FolderSupport.Mark)
+ );
+ foreach (var actions in this.folder_conversation_actions) {
+ actions.set_mark_sensitive(mark_enabled);
+ }
+
get_window_action(ACTION_ARCHIVE_CONVERSATION).set_enabled(
- sensitive && (selected_folder is Geary.FolderSupport.Archive)
+ sensitive && (this.selected_folder is Geary.FolderSupport.Archive)
);
get_window_action(ACTION_TRASH_CONVERSATION).set_enabled(
sensitive && this.selected_folder_supports_trash
);
get_window_action(ACTION_DELETE_CONVERSATION).set_enabled(
- sensitive && (selected_folder is Geary.FolderSupport.Remove)
+ sensitive && (this.selected_folder is Geary.FolderSupport.Remove)
);
switch (count) {
@@ -1876,7 +1884,6 @@ public class Application.MainWindow :
);
this.conversation_list_actions.update_trash_button(show_trash);
this.main_toolbar.full_actions.update_trash_button(show_trash);
- this.main_toolbar.compact_actions.update_trash_button(show_trash);
}
private async void update_context_dependent_actions(bool sensitive) {
@@ -1915,10 +1922,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..0876dd278 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);
@@ -82,6 +87,10 @@ public class Components.ConversationActions : Gtk.Box {
this.copy_message_button.sensitive = is_sensitive;
}
+ public void set_mark_sensitive(bool is_sensitive) {
+ this.mark_message_button.sensitive = is_sensitive;
+ }
+
public void show_copy_menu() {
this.copy_message_button.clicked();
}
@@ -91,6 +100,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]