[geary/mjog/account-command-stacks: 17/27] Don't initially notify on mark email commands
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/account-command-stacks: 17/27] Don't initially notify on mark email commands
- Date: Sat, 26 Oct 2019 05:35:39 +0000 (UTC)
commit 0ebd53253e68fb7e1025ac6d5624362bd4f3ff37
Author: Michael Gratton <mike vee net>
Date: Tue Oct 22 23:40:31 2019 +1100
Don't initially notify on mark email commands
These already have visual feedback and are easily-undoable.
src/client/application/application-controller.vala | 13 ++++++++-
src/client/components/main-window.vala | 34 +++++++++++++++-------
2 files changed, 35 insertions(+), 12 deletions(-)
---
diff --git a/src/client/application/application-controller.vala
b/src/client/application/application-controller.vala
index 9f2b4abb..f062a9e2 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -2285,7 +2285,18 @@ public class Application.Controller : Geary.BaseObject {
}
-private class Application.MarkEmailCommand : Command {
+/**
+ * Mixin for trivial application commands.
+ *
+ * Trivial commands should not cause a notification to be shown when
+ * initially executed.
+ */
+public interface Application.TrivialCommand : Command {
+
+}
+
+
+private class Application.MarkEmailCommand : TrivialCommand, Command {
private Geary.App.EmailStore store;
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 2c23bde0..bcc9dcde 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -277,7 +277,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
this.commands = commands;
this.commands.executed.connect(on_command_execute);
this.commands.undone.connect(on_command_undo);
- this.commands.redone.connect(on_command_execute);
+ this.commands.redone.connect(on_command_redo);
update_command_actions();
update_conversation_actions(NONE);
@@ -1286,13 +1286,15 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
}
private void on_command_execute(Application.Command command) {
- if (command.executed_label != null) {
- Components.InAppNotification ian =
- new Components.InAppNotification(command.executed_label);
- ian.set_button(_("Undo"), "win." + GearyApplication.ACTION_UNDO);
- add_notification(ian);
+ if (!(command is Application.TrivialCommand)) {
+ // Only show an execute notification for non-trivial
+ // commands
+ on_command_redo(command);
+ } else {
+ // Still have to update the undo/redo actions for trivial
+ // commands
+ update_command_actions();
}
- update_command_actions();
}
private void on_command_undo(Application.Command command) {
@@ -1305,9 +1307,19 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
update_command_actions();
}
+ private void on_command_redo(Application.Command command) {
+ if (command.executed_label != null) {
+ Components.InAppNotification ian =
+ new Components.InAppNotification(command.executed_label);
+ ian.set_button(_("Undo"), "win." + GearyApplication.ACTION_UNDO);
+ add_notification(ian);
+ }
+ update_command_actions();
+ }
+
private void on_conversation_view_added(ConversationListBox list) {
list.email_added.connect(on_conversation_viewer_email_added);
- list.mark_emails.connect(on_conversation_viewer_mark_emails);
+ list.mark_emails.connect(on_mark_messages);
}
private void on_conversation_viewer_email_added(ConversationEmail view) {
@@ -1702,9 +1714,9 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
// Individual message view action callbacks
- private void on_conversation_viewer_mark_emails(Gee.Collection<Geary.EmailIdentifier> messages,
- Geary.EmailFlags? to_add,
- Geary.EmailFlags? to_remove) {
+ private void on_mark_messages(Gee.Collection<Geary.EmailIdentifier> messages,
+ Geary.EmailFlags? to_add,
+ Geary.EmailFlags? to_remove) {
Geary.Account? target = this.current_account;
if (target != null) {
this.application.controller.mark_messages.begin(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]