Merge Controller.move_conversations and move_messages impls
Use the same implementation for moving conversations and messages so that marking messages is notified in the same way as marking conversations. Athough in the case of the latter, only a subset of the messages in a conversation may get marked, it makes the UI notification UI present more consistently.
This commit is contained in:
parent
a282dc546e
commit
b4d3c60a61
3 changed files with 38 additions and 39 deletions
|
|
@ -554,31 +554,13 @@ public class Application.Controller : Geary.BaseObject {
|
|||
}
|
||||
}
|
||||
|
||||
AccountContext? context = this.accounts.get(target.information);
|
||||
if (context != null) {
|
||||
yield context.commands.execute(
|
||||
new MarkEmailCommand(
|
||||
context.emails,
|
||||
messages,
|
||||
do_add ? flags : null,
|
||||
do_add ? null : flags,
|
||||
/// Translators: Label for in-app undo notification
|
||||
ngettext(
|
||||
"Conversation marked",
|
||||
"Conversations marked",
|
||||
selected.size
|
||||
),
|
||||
/// Translators: Label for in-app undo notification
|
||||
ngettext(
|
||||
"Conversation un-marked",
|
||||
"Conversations un-marked",
|
||||
selected.size
|
||||
)
|
||||
|
||||
),
|
||||
context.cancellable
|
||||
);
|
||||
}
|
||||
yield mark_messages(
|
||||
target,
|
||||
conversations,
|
||||
messages,
|
||||
do_add ? flags : null,
|
||||
do_add ? null : flags
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -590,6 +572,7 @@ public class Application.Controller : Geary.BaseObject {
|
|||
* case, use {@link mark_conversations}.
|
||||
*/
|
||||
public async void mark_messages(Geary.Account target,
|
||||
Gee.Collection<Geary.App.Conversation> conversations,
|
||||
Gee.Collection<Geary.EmailIdentifier> messages,
|
||||
Geary.EmailFlags? to_add,
|
||||
Geary.EmailFlags? to_remove)
|
||||
|
|
@ -602,17 +585,17 @@ public class Application.Controller : Geary.BaseObject {
|
|||
messages,
|
||||
to_add,
|
||||
to_remove,
|
||||
/// Translators: Label for in-app undo notification
|
||||
/// Translators: Label for in-app notification
|
||||
ngettext(
|
||||
"Message marked",
|
||||
"Messages marked",
|
||||
messages.size
|
||||
"Conversation marked",
|
||||
"Conversations marked",
|
||||
conversations.size
|
||||
),
|
||||
/// Translators: Label for in-app undo notification
|
||||
/// Translators: Label for in-app notification
|
||||
ngettext(
|
||||
"Message un-marked",
|
||||
"Messages un-marked",
|
||||
messages.size
|
||||
"Conversation un-marked",
|
||||
"Conversations un-marked",
|
||||
conversations.size
|
||||
)
|
||||
),
|
||||
context.cancellable
|
||||
|
|
|
|||
|
|
@ -1780,13 +1780,15 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
|
|||
|
||||
// Individual message view action callbacks
|
||||
|
||||
private void on_mark_messages(Gee.Collection<Geary.EmailIdentifier> messages,
|
||||
private void on_mark_messages(Geary.App.Conversation conversation,
|
||||
Gee.Collection<Geary.EmailIdentifier> messages,
|
||||
Geary.EmailFlags? to_add,
|
||||
Geary.EmailFlags? to_remove) {
|
||||
Geary.Account? target = this.selected_account;
|
||||
if (target != null) {
|
||||
this.application.controller.mark_messages.begin(
|
||||
target,
|
||||
Geary.Collection.single(conversation),
|
||||
messages,
|
||||
to_add,
|
||||
to_remove,
|
||||
|
|
|
|||
|
|
@ -543,8 +543,12 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|||
public signal void email_removed(ConversationEmail email);
|
||||
|
||||
/** Fired when the user updates the flags for a set of emails. */
|
||||
public signal void mark_emails(Gee.Collection<Geary.EmailIdentifier> emails,
|
||||
Geary.EmailFlags? flags_to_add, Geary.EmailFlags? flags_to_remove);
|
||||
public signal void mark_emails(
|
||||
Geary.App.Conversation conversation,
|
||||
Gee.Collection<Geary.EmailIdentifier> emails,
|
||||
Geary.EmailFlags? flags_to_add,
|
||||
Geary.EmailFlags? flags_to_remove
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -1046,7 +1050,7 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|||
if (email_ids.size > 0) {
|
||||
Geary.EmailFlags flags = new Geary.EmailFlags();
|
||||
flags.add(Geary.EmailFlags.UNREAD);
|
||||
mark_emails(email_ids, null, flags);
|
||||
mark_emails(this.conversation, email_ids, null, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1137,7 +1141,12 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|||
Gee.Collection<Geary.EmailIdentifier> ids =
|
||||
new Gee.LinkedList<Geary.EmailIdentifier>();
|
||||
ids.add(view.email.id);
|
||||
mark_emails(ids, flag_to_flags(to_add), flag_to_flags(to_remove));
|
||||
mark_emails(
|
||||
this.conversation,
|
||||
ids,
|
||||
flag_to_flags(to_add),
|
||||
flag_to_flags(to_remove)
|
||||
);
|
||||
}
|
||||
|
||||
private void on_mark_email_from_here(ConversationEmail view,
|
||||
|
|
@ -1156,7 +1165,12 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
|
|||
}
|
||||
}
|
||||
});
|
||||
mark_emails(ids, flag_to_flags(to_add), flag_to_flags(to_remove));
|
||||
mark_emails(
|
||||
this.conversation,
|
||||
ids,
|
||||
flag_to_flags(to_add),
|
||||
flag_to_flags(to_remove)
|
||||
);
|
||||
}
|
||||
|
||||
private void on_message_body_state_notify(GLib.Object obj,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue