Commit 43917f0a authored by Dan Vrátil's avatar Dan Vrátil
Browse files

Remove some unused code from EMailReader

This is leftover from the WebKit port and it didn't work
properly. Most of the code was removed, some was moved
to a better place.
parent d783fee9
......@@ -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");
......
......@@ -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);
}
}
......@@ -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 */
......@@ -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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment