aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--em-format/e-mail-formatter.c14
-rw-r--r--mail/e-mail-display.c12
-rw-r--r--mail/e-mail-display.h3
-rw-r--r--mail/e-mail-reader.c44
4 files changed, 25 insertions, 48 deletions
diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c
index 99b00361c9..21779162c5 100644
--- a/em-format/e-mail-formatter.c
+++ b/em-format/e-mail-formatter.c
@@ -1321,15 +1321,17 @@ e_mail_formatter_set_charset (EMailFormatter *formatter,
const gchar *charset)
{
g_return_if_fail (E_IS_MAIL_FORMATTER (formatter));
- g_return_if_fail (charset && *charset);
if (g_strcmp0 (formatter->priv->charset, charset) == 0)
return;
- if (formatter->priv->charset)
- g_free (formatter->priv->charset);
+ g_free (formatter->priv->charset);
- formatter->priv->charset = g_strdup (charset);
+ if (!charset) {
+ formatter->priv->charset = NULL;
+ } else {
+ formatter->priv->charset = g_strdup (charset);
+ }
g_object_notify (G_OBJECT (formatter), "charset");
}
@@ -1352,9 +1354,7 @@ e_mail_formatter_set_default_charset (EMailFormatter *formatter,
if (g_strcmp0 (formatter->priv->default_charset, default_charset) == 0)
return;
- if (formatter->priv->default_charset)
- g_free (formatter->priv->default_charset);
-
+ g_free (formatter->priv->default_charset);
formatter->priv->default_charset = g_strdup (default_charset);
g_object_notify (G_OBJECT (formatter), "default-charset");
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 2ca422c353..63a1c0121e 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1923,3 +1923,15 @@ e_mail_display_set_force_load_images (EMailDisplay *display,
display->priv->force_image_load = force_load_images;
}
+
+void
+e_mail_display_set_charset (EMailDisplay *display,
+ const gchar *charset)
+{
+ g_return_if_fail (E_IS_MAIL_DISPLAY (display));
+
+ if (display->priv->formatter) {
+ e_mail_formatter_set_charset (
+ display->priv->formatter, charset);
+ }
+}
diff --git a/mail/e-mail-display.h b/mail/e-mail-display.h
index 48c16f36a2..99ad73a376 100644
--- a/mail/e-mail-display.h
+++ b/mail/e-mail-display.h
@@ -103,6 +103,9 @@ void e_mail_display_set_force_load_images
(EMailDisplay *display,
gboolean force_load_images);
+void e_mail_display_set_charset (EMailDisplay *display,
+ const gchar *charset);
+
G_END_DECLS
#endif /* E_MAIL_DISPLAY_H */
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 40da43780c..b90b77d160 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -88,8 +88,6 @@ struct _EMailReaderPrivate {
EMailForwardStyle forward_style;
EMailReplyStyle reply_style;
- EMailFormatter *formatter;
-
/* This timer runs when the user selects a single message. */
guint message_selected_timeout_id;
@@ -376,18 +374,17 @@ action_mail_charset_cb (GtkRadioAction *action,
GtkRadioAction *current,
EMailReader *reader)
{
- EMailFormatter *formatter;
+ EMailDisplay *display;
const gchar *charset;
if (action != current)
return;
- formatter = e_mail_reader_get_formatter (reader);
+ display = e_mail_reader_get_mail_display (reader);
charset = g_object_get_data (G_OBJECT (action), "charset");
/* Charset for "Default" action will be NULL. */
- if (formatter)
- e_mail_formatter_set_charset (formatter, charset);
+ e_mail_display_set_charset (display, charset);
}
static void
@@ -4758,38 +4755,3 @@ e_mail_reader_avoid_next_mark_as_seen (EMailReader *reader)
priv->avoid_next_mark_as_seen = TRUE;
}
-
-EMailFormatter *
-e_mail_reader_get_formatter (EMailReader *reader)
-{
- EMailReaderPrivate *priv;
-
- g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
-
- priv = E_MAIL_READER_GET_PRIVATE (reader);
- g_return_val_if_fail (priv != NULL, NULL);
-
- return priv->formatter;
-}
-
-void
-e_mail_reader_set_formatter (EMailReader *reader,
- EMailFormatter *formatter)
-{
- EMailReaderPrivate *priv;
-
- g_return_if_fail (E_IS_MAIL_READER (reader));
- g_return_if_fail (E_IS_MAIL_FORMATTER (formatter));
-
- priv = E_MAIL_READER_GET_PRIVATE (reader);
- g_return_if_fail (priv != NULL);
-
- g_object_ref (formatter);
-
- if (priv->formatter) {
- g_object_unref (priv->formatter);
- }
-
- priv->formatter = formatter;
-
-}