[geary/wip/713592-drafts] Have DraftManager deal in RFC822.Messages, not ComposedEmail.
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/713592-drafts] Have DraftManager deal in RFC822.Messages, not ComposedEmail.
- Date: Fri, 9 Jan 2015 00:55:46 +0000 (UTC)
commit 918d6113ad195b5a3b945da194c5be0e90c9ad28
Author: Jim Nelson <jim yorba org>
Date: Thu Jan 8 16:55:30 2015 -0800
Have DraftManager deal in RFC822.Messages, not ComposedEmail.
src/client/composer/composer-widget.vala | 6 ++++--
src/engine/api/geary-composed-email.vala | 4 ++++
src/engine/app/app-draft-manager.vala | 19 +++++++++----------
3 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index f7b94c9..6e4b9da 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -1186,8 +1186,10 @@ public class ComposerWidget : Gtk.EventBox {
cancel_draft_timer();
try {
- if (draft_manager != null)
- return draft_manager.update(get_composed_email(null, true), draft_flags, null);
+ if (draft_manager != null) {
+ return draft_manager.update(get_composed_email(null, true).to_rfc822_message(),
+ draft_flags, null);
+ }
} catch (Error err) {
GLib.message("Unable to save draft: %s", err.message);
}
diff --git a/src/engine/api/geary-composed-email.vala b/src/engine/api/geary-composed-email.vala
index a9f9403..e668141 100644
--- a/src/engine/api/geary-composed-email.vala
+++ b/src/engine/api/geary-composed-email.vala
@@ -45,5 +45,9 @@ public class Geary.ComposedEmail : BaseObject {
this.body_text = body_text;
this.body_html = body_html;
}
+
+ public Geary.RFC822.Message to_rfc822_message(string? message_id = null) {
+ return new RFC822.Message.from_composed_email(this, message_id);
+ }
}
diff --git a/src/engine/app/app-draft-manager.vala b/src/engine/app/app-draft-manager.vala
index 2aad54c..14a9aa5 100644
--- a/src/engine/app/app-draft-manager.vala
+++ b/src/engine/app/app-draft-manager.vala
@@ -63,12 +63,12 @@ public class Geary.App.DraftManager : BaseObject {
private class Operation : BaseObject {
public OperationType op_type;
- public ComposedEmail? draft;
+ public RFC822.Message? draft;
public EmailFlags? flags;
public DateTime? date_received;
public Nonblocking.Semaphore? semaphore;
- public Operation(OperationType op_type, ComposedEmail? draft, EmailFlags? flags,
+ public Operation(OperationType op_type, RFC822.Message? draft, EmailFlags? flags,
DateTime? date_received, Nonblocking.Semaphore? semaphore) {
this.op_type = op_type;
this.draft = draft;
@@ -131,7 +131,7 @@ public class Geary.App.DraftManager : BaseObject {
/**
* Fired when a draft is successfully saved.
*/
- public signal void stored(Geary.ComposedEmail draft);
+ public signal void stored(Geary.RFC822.Message draft);
/**
* Fired when a draft is discarded.
@@ -144,7 +144,7 @@ public class Geary.App.DraftManager : BaseObject {
* This occurs when a draft is scheduled for { link update} while another draft is queued
* to be pushed to the server. The queued draft is dropped in favor of the new one.
*/
- public signal void dropped(Geary.ComposedEmail draft);
+ public signal void dropped(Geary.RFC822.Message draft);
/**
* Fired when unable to save a draft but the { link DraftManager} remains open.
@@ -153,7 +153,7 @@ public class Geary.App.DraftManager : BaseObject {
* { link fatal}. It should not be assumed this signal firing means DraftManager is still
* operational, but if fatal fires, it definitely is not operational.
*/
- public virtual signal void draft_failed(Geary.ComposedEmail draft, Error err) {
+ public virtual signal void draft_failed(Geary.RFC822.Message draft, Error err) {
debug("%s: Unable to create draft: %s", to_string(), err.message);
}
@@ -172,7 +172,7 @@ public class Geary.App.DraftManager : BaseObject {
this.account = account;
}
- protected void notify_stored(Geary.ComposedEmail draft) {
+ protected void notify_stored(Geary.RFC822.Message draft) {
versions_saved++;
stored(draft);
}
@@ -318,7 +318,7 @@ public class Geary.App.DraftManager : BaseObject {
* @returns A { link Semaphore} that is notified when the operation completes (with or without
* error)
*/
- public Geary.Nonblocking.Semaphore? update(Geary.ComposedEmail draft, Geary.EmailFlags? flags,
+ public Geary.Nonblocking.Semaphore? update(Geary.RFC822.Message draft, Geary.EmailFlags? flags,
DateTime? date_received) throws Error {
check_open();
@@ -344,7 +344,7 @@ public class Geary.App.DraftManager : BaseObject {
}
// Note that this call doesn't check_open(), important when used within close_async()
- private Nonblocking.Semaphore? submit_push(ComposedEmail? draft, EmailFlags? flags,
+ private Nonblocking.Semaphore? submit_push(RFC822.Message? draft, EmailFlags? flags,
DateTime? date_received) {
// no drafts are pushed when discarding on close
if (draft != null && discard_on_close) {
@@ -439,9 +439,8 @@ public class Geary.App.DraftManager : BaseObject {
// if draft supplied, save it
if (op.draft != null) {
- RFC822.Message rfc822 = new RFC822.Message.from_composed_email(op.draft, null);
try {
- current_draft_id = yield create_support.create_email_async(rfc822, op.flags,
+ current_draft_id = yield create_support.create_email_async(op.draft, op.flags,
op.date_received, current_draft_id, null);
draft_state = DraftState.STORED;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]