[evolution/webkit: 71/113] EMFormat accept and correctly handle null CamelFolder
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 71/113] EMFormat accept and correctly handle null CamelFolder
- Date: Tue, 10 Jan 2012 09:54:34 +0000 (UTC)
commit 5faa3e2898f5ea64adbacd821a228e207df140cc
Author: Dan VrÃtil <dvratil redhat com>
Date: Wed Nov 30 18:40:37 2011 +0100
EMFormat accept and correctly handle null CamelFolder
em-format/.em-format-quote.c.kate-swp | Bin 0 -> 94 bytes
em-format/em-format.c | 25 +++++++++++++------------
mail/e-mail-printer.c | 10 ++++++----
mail/em-composer-utils.c | 14 +-------------
mail/em-format-html-print.c | 3 ++-
5 files changed, 22 insertions(+), 30 deletions(-)
---
diff --git a/em-format/.em-format-quote.c.kate-swp b/em-format/.em-format-quote.c.kate-swp
new file mode 100644
index 0000000..a76e4c6
Binary files /dev/null and b/em-format/.em-format-quote.c.kate-swp differ
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 1890fb3..b6e9327 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1184,9 +1184,6 @@ emf_parse (EMFormat *emf,
emf->folder = g_object_ref (folder);
}
- g_return_if_fail (emf->message);
- g_return_if_fail (emf->folder);
-
part_id = g_string_new (".message");
/* Create a special PURI with entire message */
@@ -1246,7 +1243,7 @@ static EMFormatHandler type_handlers[] = {
{ (gchar *) "multipart/mixed", emf_parse_multipart_mixed, },
{ (gchar *) "multipart/signed", emf_parse_multipart_signed, },
{ (gchar *) "multipart/related", emf_parse_multipart_related, },
- { (gchar *) "multipart/digest", emf_parse_multipart_digest, EM_FORMAT_HANDLER_COMPOUND_TYPE },
+ { (gchar *) "multipart/digest", emf_parse_multipart_digest, 0, EM_FORMAT_HANDLER_COMPOUND_TYPE },
{ (gchar *) "multipart/*", emf_parse_multipart_mixed, 0, EM_FORMAT_HANDLER_COMPOUND_TYPE },
/* Ignore PGP signature part */
@@ -1892,7 +1889,6 @@ em_format_parse (EMFormat *emf,
g_return_if_fail (EM_IS_FORMAT (emf));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
class = EM_FORMAT_GET_CLASS (emf);
g_return_if_fail (class->parse != NULL);
@@ -2341,21 +2337,26 @@ em_format_build_mail_uri (CamelFolder *folder,
gchar *uri, *tmp;
va_list ap;
const gchar *name;
- const gchar *service_uid;
+ const gchar *service_uid, *folder_name;
char separator;
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
g_return_val_if_fail (message_uid && *message_uid, NULL);
- store = camel_folder_get_parent_store (folder);
- if (store)
- service_uid = camel_service_get_uid (CAMEL_SERVICE (store));
- else
+ if (!folder) {
+ folder_name = "generic";
service_uid = "generic";
+ } else {
+ folder_name = camel_folder_get_full_name (folder);
+ store = camel_folder_get_parent_store (folder);
+ if (store)
+ service_uid = camel_service_get_uid (CAMEL_SERVICE (store));
+ else
+ service_uid = "generic";
+ }
tmp = g_strdup_printf ("mail://%s/%s/%s",
service_uid,
- camel_folder_get_full_name (folder),
+ folder_name,
message_uid);
va_start (ap, first_param_name);
diff --git a/mail/e-mail-printer.c b/mail/e-mail-printer.c
index b732fa3..e53bf41 100644
--- a/mail/e-mail-printer.c
+++ b/mail/e-mail-printer.c
@@ -723,10 +723,12 @@ e_mail_printer_print (EMailPrinter *emp,
G_CALLBACK (emp_headers_tab_apply), emp);
g_signal_connect (emp->priv->operation, "done",
G_CALLBACK (emp_printing_done), emp);
- g_signal_connect_swapped (cancellable, "cancelled",
- G_CALLBACK (gtk_print_operation_cancel), emp->priv->operation);
- g_signal_connect (emp->priv->operation, "draw-page",
- G_CALLBACK (emp_draw_footer), NULL);
+ g_signal_connect (emp->priv->operation, "draw-page",
+ G_CALLBACK (emp_draw_footer), NULL);
+
+ if (cancellable)
+ g_signal_connect_swapped (cancellable, "cancelled",
+ G_CALLBACK (gtk_print_operation_cancel), emp->priv->operation);
emp_run_print_operation (emp);
}
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index af811fa..a9b71ec 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -921,12 +921,8 @@ composer_print_done_cb (EMailPrinter *emp,
gpointer user_data)
{
EMFormat *emf = user_data;
-
- g_object_unref (emf->folder);
g_object_unref (emf);
-
g_object_unref (emp);
-
}
static void
@@ -938,20 +934,12 @@ em_utils_composer_print_cb (EMsgComposer *composer,
{
EMailPrinter *emp;
EMFormatHTMLDisplay *efhd;
- CamelFolder *folder;
-
- /* Create a virtual temporary camel folder */
- /* FIXME WEBKIT This throws a warning about null parent-store.
- * Find a better way. */
- folder = g_object_new (CAMEL_TYPE_OFFLINE_FOLDER,
- "full-name", "composer",
- "parent-store", NULL, NULL);
efhd = g_object_new (EM_TYPE_FORMAT_HTML_DISPLAY, NULL);
((EMFormat *) efhd)->message_uid = g_strdup (camel_mime_message_get_message_id (message));
/* Parse the message */
- em_format_parse ((EMFormat *) efhd, message, folder, NULL);
+ em_format_parse ((EMFormat *) efhd, message, NULL, NULL);
/* Use EMailPrinter and WebKit to print the message */
emp = e_mail_printer_new ((EMFormatHTML *) efhd, action);
diff --git a/mail/em-format-html-print.c b/mail/em-format-html-print.c
index cbf0210..f690035 100644
--- a/mail/em-format-html-print.c
+++ b/mail/em-format-html-print.c
@@ -405,7 +405,8 @@ efhp_set_orig_formatter (EMFormatHTMLPrint *efhp,
while (g_hash_table_iter_next (&iter, &key, &value))
g_hash_table_insert (emfp->mail_part_table, key, value);
- emfp->folder = g_object_ref (emfs->folder);
+ if (emfs->folder)
+ emfp->folder = g_object_ref (emfs->folder);
emfp->message_uid = g_strdup (emfs->message_uid);
emfp->message = g_object_ref (emfs->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]