aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-07 01:41:18 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-07 02:16:40 +0800
commitc5fae912d155a7e6247d92b3974a615fd17944f0 (patch)
tree7dc2050b0df17d75490a29a46f3c81f8cfee885f /em-format
parent6b3e0145df863c8f41af4e82a6ba5827a7fb767e (diff)
downloadgsoc2013-evolution-c5fae912d155a7e6247d92b3974a615fd17944f0.tar
gsoc2013-evolution-c5fae912d155a7e6247d92b3974a615fd17944f0.tar.gz
gsoc2013-evolution-c5fae912d155a7e6247d92b3974a615fd17944f0.tar.bz2
gsoc2013-evolution-c5fae912d155a7e6247d92b3974a615fd17944f0.tar.lz
gsoc2013-evolution-c5fae912d155a7e6247d92b3974a615fd17944f0.tar.xz
gsoc2013-evolution-c5fae912d155a7e6247d92b3974a615fd17944f0.tar.zst
gsoc2013-evolution-c5fae912d155a7e6247d92b3974a615fd17944f0.zip
Use CamelMimeFilterToHTMLFlags enum type where appropriate.
Diffstat (limited to 'em-format')
-rw-r--r--em-format/e-mail-formatter-attachment.c5
-rw-r--r--em-format/e-mail-formatter-headers.c3
-rw-r--r--em-format/e-mail-formatter-quote-attachment.c2
-rw-r--r--em-format/e-mail-formatter-quote-text-plain.c9
-rw-r--r--em-format/e-mail-formatter-text-plain.c8
-rw-r--r--em-format/e-mail-formatter-utils.c24
-rw-r--r--em-format/e-mail-formatter.c2
-rw-r--r--em-format/e-mail-formatter.h5
8 files changed, 35 insertions, 23 deletions
diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c
index b573aa10d0..e81f56b659 100644
--- a/em-format/e-mail-formatter-attachment.c
+++ b/em-format/e-mail-formatter-attachment.c
@@ -116,6 +116,7 @@ emfe_attachment_format (EMailFormatterExtension *extension,
EMailExtensionRegistry *reg;
GQueue *extensions;
EMailPartAttachment *empa;
+ CamelMimeFilterToHTMLFlags flags;
gchar *attachment_part_id;
g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartAttachment), FALSE);
@@ -226,9 +227,9 @@ emfe_attachment_format (EMailFormatterExtension *extension,
}
text = e_mail_part_describe (part->part, empa->snoop_mime_type);
+ flags = e_mail_formatter_get_text_format_flags (formatter);
html = camel_text_to_html (
- text, e_mail_formatter_get_text_format_flags (formatter) &
- CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
+ text, flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
g_free (text);
if (empa->attachment_view_part_id)
diff --git a/em-format/e-mail-formatter-headers.c b/em-format/e-mail-formatter-headers.c
index b7862d9a38..af51758135 100644
--- a/em-format/e-mail-formatter-headers.c
+++ b/em-format/e-mail-formatter-headers.c
@@ -105,7 +105,8 @@ format_short_headers (EMailFormatter *formatter,
subject = camel_header_unfold (header->value);
buf = camel_header_decode_string (subject, hdr_charset);
g_free (subject);
- subject = camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0);
+ subject = camel_text_to_html (
+ buf, CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0);
g_free (buf);
}
header = header->next;
diff --git a/em-format/e-mail-formatter-quote-attachment.c b/em-format/e-mail-formatter-quote-attachment.c
index 325f70fb83..c37cf60559 100644
--- a/em-format/e-mail-formatter-quote-attachment.c
+++ b/em-format/e-mail-formatter-quote-attachment.c
@@ -56,9 +56,9 @@ emfqe_attachment_format (EMailFormatterExtension *extension,
GCancellable *cancellable)
{
gchar *text, *html;
- guint32 text_format_flags;
EMailPartAttachment *empa;
EMailPart *attachment_view_part;
+ CamelMimeFilterToHTMLFlags text_format_flags;
empa = E_MAIL_PART_ATTACHMENT (part);
diff --git a/em-format/e-mail-formatter-quote-text-plain.c b/em-format/e-mail-formatter-quote-text-plain.c
index 95d7b54539..5f73aba3f5 100644
--- a/em-format/e-mail-formatter-quote-text-plain.c
+++ b/em-format/e-mail-formatter-quote-text-plain.c
@@ -58,21 +58,22 @@ emqfe_text_plain_format (EMailFormatterExtension *extension,
CamelMimeFilter *sig_strip;
CamelContentType *type;
EMailFormatterQuoteContext *qf_context;
+ CamelMimeFilterToHTMLFlags text_flags;
const gchar *format;
- guint32 rgb = 0x737373, text_flags;
+ guint32 rgb = 0x737373;
if (!part->part)
return FALSE;
qf_context = (EMailFormatterQuoteContext *) context;
- text_flags = CAMEL_MIME_FILTER_TOHTML_PRE |
+ text_flags =
+ CAMEL_MIME_FILTER_TOHTML_PRE |
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
- if (e_mail_formatter_get_mark_citations (formatter)) {
+ if (e_mail_formatter_get_mark_citations (formatter))
text_flags |= CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
- }
/* Check for RFC 2646 flowed text. */
type = camel_mime_part_get_content_type (part->part);
diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c
index 78b1919e6e..bf83e166dd 100644
--- a/em-format/e-mail-formatter-text-plain.c
+++ b/em-format/e-mail-formatter-text-plain.c
@@ -59,7 +59,6 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
CamelMimeFilter *html_filter;
gchar *content;
const gchar *format;
- guint32 filter_flags;
guint32 rgb;
if (g_cancellable_is_cancelled (cancellable))
@@ -67,6 +66,7 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
if ((context->mode == E_MAIL_FORMATTER_MODE_RAW) ||
(context->mode == E_MAIL_FORMATTER_MODE_PRINTING)) {
+ CamelMimeFilterToHTMLFlags flags;
if (context->mode == E_MAIL_FORMATTER_MODE_RAW) {
gchar *header;
@@ -81,7 +81,7 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
cancellable, NULL);
}
- filter_flags = e_mail_formatter_get_text_format_flags (formatter);
+ flags = e_mail_formatter_get_text_format_flags (formatter);
dw = camel_medium_get_content (CAMEL_MEDIUM (part->part));
if (!dw)
@@ -91,14 +91,14 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
if (camel_content_type_is (dw->mime_type, "text", "plain")
&& (format = camel_content_type_param (dw->mime_type, "format"))
&& !g_ascii_strcasecmp (format, "flowed"))
- filter_flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED;
+ flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED;
rgb = e_color_to_value ((GdkColor *)
e_mail_formatter_get_color (
formatter, E_MAIL_FORMATTER_COLOR_CITATION));
filtered_stream = camel_stream_filter_new (stream);
- html_filter = camel_mime_filter_tohtml_new (filter_flags, rgb);
+ html_filter = camel_mime_filter_tohtml_new (flags, rgb);
camel_stream_filter_add (
CAMEL_STREAM_FILTER (filtered_stream), html_filter);
g_object_unref (html_filter);
diff --git a/em-format/e-mail-formatter-utils.c b/em-format/e-mail-formatter-utils.c
index e738d615a6..5fdb885e9a 100644
--- a/em-format/e-mail-formatter-utils.c
+++ b/em-format/e-mail-formatter-utils.c
@@ -59,12 +59,16 @@ e_mail_formatter_format_text_header (EMailFormatter *formatter,
while (*value == ' ')
value++;
- if (!(flags & E_MAIL_FORMATTER_HEADER_FLAG_HTML))
+ if (!(flags & E_MAIL_FORMATTER_HEADER_FLAG_HTML)) {
+ CamelMimeFilterToHTMLFlags text_format_flags;
+
+ text_format_flags =
+ e_mail_formatter_get_text_format_flags (formatter);
html = mhtml = camel_text_to_html (
- value,
- e_mail_formatter_get_text_format_flags (formatter), 0);
- else
+ value, text_format_flags, 0);
+ } else {
html = value;
+ }
is_rtl = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL;
@@ -108,7 +112,7 @@ e_mail_formatter_format_address (EMailFormatter *formatter,
gboolean no_links,
gboolean elipsize)
{
- guint32 flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
+ CamelMimeFilterToHTMLFlags flags;
gchar *name, *mailto, *addr;
gint i = 0;
gchar *str = NULL;
@@ -118,6 +122,8 @@ e_mail_formatter_format_address (EMailFormatter *formatter,
g_return_val_if_fail (out != NULL, NULL);
g_return_val_if_fail (field != NULL, NULL);
+ flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
+
while (a != NULL) {
if (a->name)
name = camel_text_to_html (a->name, flags, 0);
@@ -342,6 +348,7 @@ e_mail_formatter_format_header (EMailFormatter *formatter,
flags |= E_MAIL_FORMATTER_HEADER_FLAG_BOLD;
} else if (g_str_equal (name, "Date") || g_str_equal (name, "Resent-Date")) {
+ CamelMimeFilterToHTMLFlags text_format_flags;
gint msg_offset, local_tz;
time_t msg_date;
struct tm local;
@@ -354,9 +361,10 @@ e_mail_formatter_format_header (EMailFormatter *formatter,
while (*txt == ' ' || *txt == '\t')
txt++;
- html = camel_text_to_html (
- txt,
- e_mail_formatter_get_text_format_flags (formatter), 0);
+ text_format_flags =
+ e_mail_formatter_get_text_format_flags (formatter);
+
+ html = camel_text_to_html (txt, text_format_flags, 0);
msg_date = camel_header_decode_date (txt, &msg_offset);
e_localtime_with_offset (msg_date, &local, &local_tz);
diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c
index dcea08133e..c959a24b02 100644
--- a/em-format/e-mail-formatter.c
+++ b/em-format/e-mail-formatter.c
@@ -1110,7 +1110,7 @@ e_mail_formatter_get_extension_registry (EMailFormatter *formatter)
return E_MAIL_EXTENSION_REGISTRY (formatter_class->extension_registry);
}
-guint32
+CamelMimeFilterToHTMLFlags
e_mail_formatter_get_text_format_flags (EMailFormatter *formatter)
{
g_return_val_if_fail (E_IS_MAIL_FORMATTER (formatter), 0);
diff --git a/em-format/e-mail-formatter.h b/em-format/e-mail-formatter.h
index c0599eaa96..fd207662d5 100644
--- a/em-format/e-mail-formatter.h
+++ b/em-format/e-mail-formatter.h
@@ -107,7 +107,7 @@ struct _EMailFormatterClass {
GObjectClass parent_class;
EMailFormatterExtensionRegistry *extension_registry;
- guint32 text_html_flags;
+ CamelMimeFilterToHTMLFlags text_html_flags;
/* Colors should apply globally */
GdkColor colors[E_MAIL_FORMATTER_NUM_COLOR_TYPES];
@@ -171,7 +171,8 @@ EMailExtensionRegistry *
e_mail_formatter_get_extension_registry
(EMailFormatter *formatter);
-guint32 e_mail_formatter_get_text_format_flags
+CamelMimeFilterToHTMLFlags
+ e_mail_formatter_get_text_format_flags
(EMailFormatter *formatter);
const GdkColor *