Play sound after sending an email: Closes #5429

This commit is contained in:
Christian Dywan 2012-06-25 16:30:23 -07:00 committed by Jim Nelson
parent 008d26d48e
commit 7827e83128
4 changed files with 20 additions and 1 deletions

View file

@ -299,6 +299,7 @@ public class GearyController {
}
account.folders_added_removed.connect(on_folders_added_removed);
account.email_sent.connect(on_sent);
// Personality-specific setup.
if (account.delete_is_archive()) {
@ -1189,6 +1190,10 @@ public class GearyController {
account.send_email_async.begin(cw.get_composed_email(get_from()));
cw.destroy();
}
private void on_sent(Geary.RFC822.Message rfc822) {
NotificationBubble.play_sound("message-sent-email");
}
public void set_busy(bool is_busy) {
busy_count += is_busy ? 1 : -1;

View file

@ -7,6 +7,9 @@
public abstract class Geary.EngineAccount : Geary.AbstractAccount, Geary.Personality {
private AccountInformation account_information;
public virtual signal void email_sent(Geary.RFC822.Message rfc822) {
}
public EngineAccount(string name, string username, AccountInformation account_information,
File user_data_dir) {
base (name);
@ -14,6 +17,10 @@ public abstract class Geary.EngineAccount : Geary.AbstractAccount, Geary.Persona
this.account_information = account_information;
}
protected virtual void notify_email_sent(Geary.RFC822.Message rfc822) {
email_sent(rfc822);
}
public virtual AccountInformation get_account_information() {
return account_information;
}
@ -23,4 +30,3 @@ public abstract class Geary.EngineAccount : Geary.AbstractAccount, Geary.Persona
public abstract async void send_email_async(Geary.ComposedEmail composed, Cancellable? cancellable = null)
throws Error;
}

View file

@ -10,6 +10,8 @@ private class Geary.Imap.Account : Object {
public const string INBOX_NAME = "INBOX";
public const string ASSUMED_SEPARATOR = "/";
public signal void email_sent(Geary.RFC822.Message rfc822);
private class StatusOperation : Geary.NonblockingBatchOperation {
public ClientSessionManager session_mgr;
public MailboxInformation mbox;
@ -190,6 +192,7 @@ private class Geary.Imap.Account : Object {
yield smtp.login_async(cred, cancellable);
try {
yield smtp.send_email_async(rfc822, cancellable);
email_sent(rfc822);
} finally {
// always logout
try {

View file

@ -26,6 +26,7 @@ private abstract class Geary.GenericImapAccount : Geary.EngineAccount {
this.local = local;
this.remote.login_failed.connect(on_login_failed);
this.remote.email_sent.connect(on_email_sent);
if (inbox_path == null) {
inbox_path = new Geary.FolderRoot(Imap.Account.INBOX_NAME, Imap.Account.ASSUMED_SEPARATOR,
@ -299,6 +300,10 @@ private abstract class Geary.GenericImapAccount : Geary.EngineAccount {
Geary.RFC822.Message rfc822 = new Geary.RFC822.Message.from_composed_email(composed);
yield outbox.create_email_async(rfc822, cancellable);
}
private void on_email_sent(Geary.RFC822.Message rfc822) {
notify_email_sent(rfc822);
}
private void on_login_failed(Geary.Credentials? credentials) {
notify_report_problem(Geary.Account.Problem.LOGIN_FAILED, credentials, null);