aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-browser.c35
-rw-r--r--mail/e-mail-reader-utils.c52
-rw-r--r--mail/e-mail-reader.c130
-rw-r--r--mail/e-mail-reader.h8
-rw-r--r--mail/em-format-html-display.c23
-rw-r--r--mail/em-format-html-print.c15
-rw-r--r--mail/em-format-html.c78
-rw-r--r--mail/em-format-html.h5
-rw-r--r--mail/em-utils.c8
9 files changed, 194 insertions, 160 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index ca582ccd35..e076585755 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -49,7 +49,7 @@ struct _EMailBrowserPrivate {
EFocusTracker *focus_tracker;
EShellBackend *shell_backend;
GtkActionGroup *action_group;
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTMLDisplay *formatter;
GtkWidget *main_menu;
GtkWidget *main_toolbar;
@@ -239,10 +239,11 @@ static void
mail_browser_message_selected_cb (EMailBrowser *browser,
const gchar *uid)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
CamelMessageInfo *info;
CamelFolder *folder;
EMailReader *reader;
+ EWebView *web_view;
const gchar *title;
if (uid == NULL)
@@ -250,7 +251,8 @@ mail_browser_message_selected_cb (EMailBrowser *browser,
reader = E_MAIL_READER (browser);
folder = e_mail_reader_get_folder (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
+ web_view = em_format_html_get_web_view (formatter);
info = camel_folder_get_message_info (folder, uid);
@@ -262,8 +264,7 @@ mail_browser_message_selected_cb (EMailBrowser *browser,
title = _("(No Subject)");
gtk_window_set_title (GTK_WINDOW (browser), title);
- gtk_widget_grab_focus (
- GTK_WIDGET (((EMFormatHTML *) html_display)->html));
+ gtk_widget_grab_focus (GTK_WIDGET (web_view));
camel_folder_free_message_info (folder, info);
}
@@ -425,9 +426,9 @@ mail_browser_dispose (GObject *object)
priv->action_group = NULL;
}
- if (priv->html_display != NULL) {
- g_object_unref (priv->html_display);
- priv->html_display = NULL;
+ if (priv->formatter != NULL) {
+ g_object_unref (priv->formatter);
+ priv->formatter = NULL;
}
if (priv->main_menu != NULL) {
@@ -463,8 +464,8 @@ mail_browser_dispose (GObject *object)
static void
mail_browser_constructed (GObject *object)
{
- EMFormatHTMLDisplay *html_display;
EMailBrowserPrivate *priv;
+ EMFormatHTML *formatter;
EMailReader *reader;
EShellBackend *shell_backend;
EShell *shell;
@@ -500,10 +501,10 @@ mail_browser_constructed (GObject *object)
priv->ui_manager = ui_manager;
domain = GETTEXT_PACKAGE;
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
e_shell_watch_window (shell, GTK_WINDOW (object));
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ web_view = em_format_html_get_web_view (formatter);
/* The message list is a widget, but it is not shown in the browser.
* Unfortunately, the widget is inseparable from its model, and the
@@ -602,7 +603,7 @@ mail_browser_constructed (GObject *object)
g_signal_connect_swapped (
search_bar, "changed",
- G_CALLBACK (em_format_redraw), priv->html_display);
+ G_CALLBACK (em_format_redraw), priv->formatter);
/* Bind GObject properties to GConf keys. */
@@ -653,14 +654,14 @@ mail_browser_get_hide_deleted (EMailReader *reader)
return !e_mail_browser_get_show_deleted (browser);
}
-static EMFormatHTMLDisplay *
-mail_browser_get_html_display (EMailReader *reader)
+static EMFormatHTML *
+mail_browser_get_formatter (EMailReader *reader)
{
EMailBrowserPrivate *priv;
priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
- return priv->html_display;
+ return EM_FORMAT_HTML (priv->formatter);
}
static GtkWidget *
@@ -795,8 +796,8 @@ static void
mail_browser_iface_init (EMailReaderIface *iface)
{
iface->get_action_group = mail_browser_get_action_group;
+ iface->get_formatter = mail_browser_get_formatter;
iface->get_hide_deleted = mail_browser_get_hide_deleted;
- iface->get_html_display = mail_browser_get_html_display;
iface->get_message_list = mail_browser_get_message_list;
iface->get_popup_menu = mail_browser_get_popup_menu;
iface->get_shell_backend = mail_browser_get_shell_backend;
@@ -814,7 +815,7 @@ mail_browser_init (EMailBrowser *browser)
browser->priv = E_MAIL_BROWSER_GET_PRIVATE (browser);
browser->priv->action_group = gtk_action_group_new ("mail-browser");
- browser->priv->html_display = em_format_html_display_new ();
+ browser->priv->formatter = em_format_html_display_new ();
bridge = gconf_bridge_get ();
prefix = "/apps/evolution/mail/mail_browser";
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 9d798d92c9..f50aea7636 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -131,7 +131,7 @@ void
e_mail_reader_mark_as_read (EMailReader *reader,
const gchar *uid)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
CamelFolder *folder;
guint32 mask, set;
guint32 flags;
@@ -140,14 +140,14 @@ e_mail_reader_mark_as_read (EMailReader *reader,
g_return_if_fail (uid != NULL);
folder = e_mail_reader_get_folder (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
flags = camel_folder_get_message_flags (folder, uid);
if (!(flags & CAMEL_MESSAGE_SEEN)) {
CamelMimeMessage *message;
- message = ((EMFormat *) html_display)->message;
+ message = EM_FORMAT (formatter)->message;
em_utils_handle_receipt (folder, uid, message);
}
@@ -278,7 +278,7 @@ void
e_mail_reader_print (EMailReader *reader,
GtkPrintOperationAction action)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EMFormatHTMLPrint *html_print;
CamelFolder *folder;
GPtrArray *uids;
@@ -293,13 +293,11 @@ e_mail_reader_print (EMailReader *reader,
if (uids->len != 1)
goto exit;
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
- html_print = em_format_html_print_new (
- (EMFormatHTML *) html_display, action);
+ html_print = em_format_html_print_new (formatter, action);
em_format_merge_handler (
- (EMFormat *) html_print,
- (EMFormat *) html_display);
+ EM_FORMAT (html_print), EM_FORMAT (formatter));
em_format_html_print_message (html_print, folder, uids->pdata[0]);
g_object_unref (html_print);
@@ -354,13 +352,12 @@ void
e_mail_reader_reply_to_message (EMailReader *reader,
gint reply_mode)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
GtkWidget *message_list;
CamelMimeMessage *new_message;
CamelMimeMessage *src_message;
CamelFolder *folder;
EWebView *web_view;
- GtkHTML *html;
struct _camel_header_raw *header;
const gchar *uid;
gchar *selection = NULL;
@@ -372,9 +369,8 @@ e_mail_reader_reply_to_message (EMailReader *reader,
g_return_if_fail (E_IS_MAIL_READER (reader));
- html_display = e_mail_reader_get_html_display (reader);
- html = ((EMFormatHTML *) html_display)->html;
- web_view = E_WEB_VIEW (html);
+ formatter = e_mail_reader_get_formatter (reader);
+ web_view = em_format_html_get_web_view (formatter);
folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
@@ -385,15 +381,14 @@ e_mail_reader_reply_to_message (EMailReader *reader,
if (!e_web_view_is_selection_active (web_view))
goto whole_message;
- selection = gtk_html_get_selection_html (html, &length);
+ selection = gtk_html_get_selection_html (GTK_HTML (web_view), &length);
if (selection == NULL || *selection == '\0')
goto whole_message;
if (!html_contains_nonwhitespace (selection, length))
goto whole_message;
- src_message =
- CAMEL_MIME_MESSAGE (((EMFormat *) html_display)->message);
+ src_message = CAMEL_MIME_MESSAGE (EM_FORMAT (formatter)->message);
new_message = camel_mime_message_new ();
/* Filter out "content-*" headers. */
@@ -424,7 +419,7 @@ e_mail_reader_reply_to_message (EMailReader *reader,
whole_message:
em_utils_reply_to_message (
- folder, uid, NULL, reply_mode, (EMFormat *) html_display);
+ folder, uid, NULL, reply_mode, EM_FORMAT (formatter));
}
void
@@ -679,24 +674,18 @@ headers_changed_cb (GConfClient *client,
GConfEntry *entry,
EMailReader *reader)
{
- EMFormat *emf;
- EMFormatHTMLDisplay *emfhd;
+ EMFormatHTML *formatter;
GSList *header_config_list, *p;
g_return_if_fail (client != NULL);
g_return_if_fail (reader != NULL);
- emfhd = e_mail_reader_get_html_display (reader);
- if (!emfhd)
- return;
-
- emf = EM_FORMAT (emfhd);
- g_return_if_fail (emf != NULL);
+ formatter = e_mail_reader_get_formatter (reader);
header_config_list = gconf_client_get_list (
client, "/apps/evolution/mail/display/headers",
GCONF_VALUE_STRING, NULL);
- em_format_clear_headers (emf);
+ em_format_clear_headers (EM_FORMAT (formatter));
for (p = header_config_list; p; p = g_slist_next(p)) {
EMailReaderHeader *h;
gchar *xml = (gchar *)p->data;
@@ -704,20 +693,21 @@ headers_changed_cb (GConfClient *client,
h = e_mail_reader_header_from_xml (xml);
if (h && h->enabled)
em_format_add_header (
- emf, h->name, EM_FORMAT_HEADER_BOLD);
+ EM_FORMAT (formatter),
+ h->name, EM_FORMAT_HEADER_BOLD);
e_mail_reader_header_free (h);
}
if (!header_config_list)
- em_format_default_headers (emf);
+ em_format_default_headers (EM_FORMAT (formatter));
g_slist_foreach (header_config_list, (GFunc) g_free, NULL);
g_slist_free (header_config_list);
/* force a redraw */
- if (emf->message)
- em_format_redraw (emf);
+ if (EM_FORMAT (formatter)->message)
+ em_format_redraw (EM_FORMAT (formatter));
}
static void
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 5475c405ff..9c300fc411 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -156,7 +156,7 @@ action_add_to_address_book_cb (GtkAction *action,
{
EShell *shell;
EShellBackend *shell_backend;
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
CamelInternetAddress *cia;
EWebView *web_view;
CamelURL *curl;
@@ -165,10 +165,10 @@ action_add_to_address_book_cb (GtkAction *action,
/* This action is defined in EMailDisplay. */
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
shell_backend = e_mail_reader_get_shell_backend (reader);
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ web_view = em_format_html_get_web_view (formatter);
uri = e_web_view_get_selected_uri (web_view);
g_return_if_fail (uri != NULL);
@@ -205,17 +205,17 @@ action_mail_charset_cb (GtkRadioAction *action,
GtkRadioAction *current,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
const gchar *charset;
if (action != current)
return;
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
charset = g_object_get_data (G_OBJECT (action), "charset");
/* Charset for "Default" action will be NULL. */
- em_format_set_charset (EM_FORMAT (html_display), charset);
+ em_format_set_charset (EM_FORMAT (formatter), charset);
}
static void
@@ -355,38 +355,38 @@ static void
action_mail_flag_clear_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
folder = e_mail_reader_get_folder (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
uids = e_mail_reader_get_selected_uids (reader);
window = e_mail_reader_get_window (reader);
em_utils_flag_for_followup_clear (window, folder, uids);
- em_format_redraw (EM_FORMAT (html_display));
+ em_format_redraw (EM_FORMAT (formatter));
}
static void
action_mail_flag_completed_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
folder = e_mail_reader_get_folder (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
uids = e_mail_reader_get_selected_uids (reader);
window = e_mail_reader_get_window (reader);
em_utils_flag_for_followup_completed (window, folder, uids);
- em_format_redraw (EM_FORMAT (html_display));
+ em_format_redraw (EM_FORMAT (formatter));
}
static void
@@ -494,11 +494,11 @@ static void
action_mail_load_images_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
- em_format_html_load_images (EM_FORMAT_HTML (html_display));
+ em_format_html_load_images (formatter);
}
static void
@@ -934,24 +934,24 @@ static void
action_mail_show_all_headers_cb (GtkToggleAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
em_format_mode_t mode;
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
if (gtk_toggle_action_get_active (action))
mode = EM_FORMAT_ALLHEADERS;
else
mode = EM_FORMAT_NORMAL;
- em_format_set_mode (EM_FORMAT (html_display), mode);
+ em_format_set_mode (EM_FORMAT (formatter), mode);
}
static void
action_mail_show_source_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EShellBackend *shell_backend;
CamelFolder *folder;
GtkWidget *browser;
@@ -967,8 +967,8 @@ action_mail_show_source_cb (GtkAction *action,
browser = e_mail_browser_new (shell_backend);
reader = E_MAIL_READER (browser);
- html_display = e_mail_reader_get_html_display (reader);
- em_format_set_mode (EM_FORMAT (html_display), EM_FORMAT_SOURCE);
+ formatter = e_mail_reader_get_formatter (reader);
+ em_format_set_mode (EM_FORMAT (formatter), EM_FORMAT_SOURCE);
e_mail_reader_set_folder (reader, folder, folder_uri);
e_mail_reader_set_message (reader, uids->pdata[0]);
gtk_widget_show (browser);
@@ -1021,11 +1021,11 @@ static void
action_mail_zoom_100_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EWebView *web_view;
- html_display = e_mail_reader_get_html_display (reader);
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ formatter = e_mail_reader_get_formatter (reader);
+ web_view = em_format_html_get_web_view (formatter);
e_web_view_zoom_100 (web_view);
}
@@ -1034,11 +1034,11 @@ static void
action_mail_zoom_in_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EWebView *web_view;
- html_display = e_mail_reader_get_html_display (reader);
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ formatter = e_mail_reader_get_formatter (reader);
+ web_view = em_format_html_get_web_view (formatter);
e_web_view_zoom_in (web_view);
}
@@ -1047,11 +1047,11 @@ static void
action_mail_zoom_out_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EWebView *web_view;
- html_display = e_mail_reader_get_html_display (reader);
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ formatter = e_mail_reader_get_formatter (reader);
+ web_view = em_format_html_get_web_view (formatter);
e_web_view_zoom_out (web_view);
}
@@ -1060,7 +1060,7 @@ static void
action_search_folder_recipient_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EWebView *web_view;
CamelURL *curl;
const gchar *folder_uri;
@@ -1069,9 +1069,9 @@ action_search_folder_recipient_cb (GtkAction *action,
/* This action is defined in EMailDisplay. */
folder_uri = e_mail_reader_get_folder_uri (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ web_view = em_format_html_get_web_view (formatter);
uri = e_web_view_get_selected_uri (web_view);
g_return_if_fail (uri != NULL);
@@ -1098,7 +1098,7 @@ static void
action_search_folder_sender_cb (GtkAction *action,
EMailReader *reader)
{
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EWebView *web_view;
CamelURL *curl;
const gchar *folder_uri;
@@ -1107,9 +1107,9 @@ action_search_folder_sender_cb (GtkAction *action,
/* This action is defined in EMailDisplay. */
folder_uri = e_mail_reader_get_folder_uri (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ web_view = em_format_html_get_web_view (formatter);
uri = e_web_view_get_selected_uri (web_view);
g_return_if_fail (uri != NULL);
@@ -1791,7 +1791,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
{
EMailReader *reader = user_data;
EMailReaderPrivate *priv;
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
GtkWidget *message_list;
EShellBackend *shell_backend;
EShellSettings *shell_settings;
@@ -1813,7 +1813,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
return;
}
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
shell_backend = e_mail_reader_get_shell_backend (reader);
@@ -1822,7 +1822,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
cursor_uid = MESSAGE_LIST (message_list)->cursor_uid;
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ web_view = em_format_html_get_web_view (formatter);
/* If the user picked a different message in the time it took
* to fetch this message, then don't bother rendering it. */
@@ -1843,7 +1843,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
(EEventTarget *) target);
em_format_format (
- EM_FORMAT (html_display), folder, message_uid, message);
+ EM_FORMAT (formatter), folder, message_uid, message);
/* Reset the shell view icon. */
e_shell_event (shell, "mail-icon", (gpointer) "evolution-mail");
@@ -1903,7 +1903,7 @@ static gboolean
mail_reader_message_selected_timeout_cb (EMailReader *reader)
{
EMailReaderPrivate *priv;
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
GtkWidget *message_list;
EWebView *web_view;
CamelFolder *folder;
@@ -1916,27 +1916,27 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
folder = e_mail_reader_get_folder (reader);
parent_store = camel_folder_get_parent_store (folder);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
cursor_uid = MESSAGE_LIST (message_list)->cursor_uid;
- format_uid = EM_FORMAT (html_display)->uid;
+ format_uid = EM_FORMAT (formatter)->uid;
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ web_view = em_format_html_get_web_view (formatter);
if (MESSAGE_LIST (message_list)->last_sel_single) {
GtkWidget *widget;
- gboolean html_display_visible;
+ gboolean web_view_visible;
gboolean selected_uid_changed;
/* Decide whether to download the full message now. */
- widget = GTK_WIDGET (EM_FORMAT_HTML (html_display)->html);
+ widget = GTK_WIDGET (web_view);
- html_display_visible = gtk_widget_get_mapped (widget);
+ web_view_visible = gtk_widget_get_mapped (widget);
selected_uid_changed = g_strcmp0 (cursor_uid, format_uid);
- if (html_display_visible && selected_uid_changed) {
+ if (web_view_visible && selected_uid_changed) {
gint op_id;
gchar *string;
gboolean store_async;
@@ -1964,7 +1964,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
priv->retrieving_message_operation_id = op_id;
}
} else {
- em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL);
+ em_format_format (EM_FORMAT (formatter), NULL, NULL, NULL);
priv->restoring_message_selection = FALSE;
}
@@ -2067,7 +2067,7 @@ mail_reader_set_folder (EMailReader *reader,
const gchar *folder_uri)
{
EMailReaderPrivate *priv;
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
CamelFolder *previous_folder;
GtkWidget *message_list;
const gchar *previous_folder_uri;
@@ -2075,7 +2075,7 @@ mail_reader_set_folder (EMailReader *reader,
priv = E_MAIL_READER_GET_PRIVATE (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
previous_folder = e_mail_reader_get_folder (reader);
@@ -2093,7 +2093,7 @@ mail_reader_set_folder (EMailReader *reader,
em_utils_folder_is_outbox (folder, folder_uri) ||
em_utils_folder_is_sent (folder, folder_uri));
- em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL);
+ em_format_format (EM_FORMAT (formatter), NULL, NULL, NULL);
priv->folder_was_just_selected = (folder != NULL);
@@ -2556,7 +2556,7 @@ e_mail_reader_init (EMailReader *reader)
EShell *shell;
EShellBackend *shell_backend;
EShellSettings *shell_settings;
- EMFormatHTMLDisplay *html_display;
+ EMFormatHTML *formatter;
EMenuToolAction *menu_tool_action;
EWebView *web_view;
GtkActionGroup *action_group;
@@ -2569,14 +2569,14 @@ e_mail_reader_init (EMailReader *reader)
g_return_if_fail (E_IS_MAIL_READER (reader));
action_group = e_mail_reader_get_action_group (reader);
- html_display = e_mail_reader_get_html_display (reader);
+ formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
shell_backend = e_mail_reader_get_shell_backend (reader);
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html);
+ web_view = em_format_html_get_web_view (formatter);
/* The "mail-forward" action is special: it uses a GtkMenuToolButton
* for its toolbar item type. So we have to create it separately. */
@@ -2930,30 +2930,30 @@ e_mail_reader_get_action_group (EMailReader *reader)
return iface->get_action_group (reader);
}
-gboolean
-e_mail_reader_get_hide_deleted (EMailReader *reader)
+EMFormatHTML *
+e_mail_reader_get_formatter (EMailReader *reader)
{
EMailReaderIface *iface;
- g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE);
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
iface = E_MAIL_READER_GET_IFACE (reader);
- g_return_val_if_fail (iface->get_hide_deleted != NULL, FALSE);
+ g_return_val_if_fail (iface->get_formatter != NULL, NULL);
- return iface->get_hide_deleted (reader);
+ return iface->get_formatter (reader);
}
-EMFormatHTMLDisplay *
-e_mail_reader_get_html_display (EMailReader *reader)
+gboolean
+e_mail_reader_get_hide_deleted (EMailReader *reader)
{
EMailReaderIface *iface;
- g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE);
iface = E_MAIL_READER_GET_IFACE (reader);
- g_return_val_if_fail (iface->get_html_display != NULL, NULL);
+ g_return_val_if_fail (iface->get_hide_deleted != NULL, FALSE);
- return iface->get_html_display (reader);
+ return iface->get_hide_deleted (reader);
}
GtkWidget *
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index 0b8f30d825..b493cff98f 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -29,7 +29,7 @@
#include <gtk/gtk.h>
#include <camel/camel.h>
-#include <mail/em-format-html-display.h>
+#include <mail/em-format-html.h>
#include <shell/e-shell-backend.h>
/* Standard GObject macros */
@@ -84,9 +84,8 @@ struct _EMailReaderIface {
GtkActionGroup *
(*get_action_group) (EMailReader *reader);
+ EMFormatHTML * (*get_formatter) (EMailReader *reader);
gboolean (*get_hide_deleted) (EMailReader *reader);
- EMFormatHTMLDisplay *
- (*get_html_display) (EMailReader *reader);
GtkWidget * (*get_message_list) (EMailReader *reader);
GtkMenu * (*get_popup_menu) (EMailReader *reader);
GPtrArray * (*get_selected_uids) (EMailReader *reader);
@@ -115,9 +114,8 @@ GtkAction * e_mail_reader_get_action (EMailReader *reader,
const gchar *action_name);
GtkActionGroup *
e_mail_reader_get_action_group (EMailReader *reader);
+EMFormatHTML * e_mail_reader_get_formatter (EMailReader *reader);
gboolean e_mail_reader_get_hide_deleted (EMailReader *reader);
-EMFormatHTMLDisplay *
- e_mail_reader_get_html_display (EMailReader *reader);
GtkWidget * e_mail_reader_get_message_list (EMailReader *reader);
GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader);
GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader);
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 422d5d23cc..db13260157 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -610,14 +610,14 @@ efhd_class_init (EMFormatHTMLDisplayClass *class)
static void
efhd_init (EMFormatHTMLDisplay *efhd)
{
- GtkHTML *html;
+ EWebView *web_view;
- html = EM_FORMAT_HTML (efhd)->html;
+ web_view = em_format_html_get_web_view (EM_FORMAT_HTML (efhd));
efhd->priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efhd);
e_mail_display_set_formatter (
- E_MAIL_DISPLAY (html), EM_FORMAT_HTML (efhd));
+ E_MAIL_DISPLAY (web_view), EM_FORMAT_HTML (efhd));
/* we want to convert url's etc */
EM_FORMAT_HTML (efhd)->text_html_flags |=
@@ -785,6 +785,7 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
EAttachmentView *view;
EAttachmentStore *store;
EAttachment *attachment;
+ EWebView *web_view;
GtkWidget *widget;
gpointer parent;
EMFormat *emf = (EMFormat *) efh;
@@ -821,7 +822,8 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
e_attachment_set_encrypted (attachment, info->encrypt);
e_attachment_set_can_show (attachment, info->handle != NULL);
- parent = gtk_widget_get_toplevel (GTK_WIDGET (efh->html));
+ web_view = em_format_html_get_web_view (efh);
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
view = em_format_html_display_get_attachment_view (efhd);
@@ -876,12 +878,15 @@ efhd_bar_resize (EMFormatHTML *efh,
{
EMFormatHTMLDisplayPrivate *priv;
GtkAllocation allocation;
+ EWebView *web_view;
GtkWidget *widget;
gint width;
priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efh);
- widget = GTK_WIDGET (efh->html);
+ web_view = em_format_html_get_web_view (efh);
+
+ widget = GTK_WIDGET (web_view);
gtk_widget_get_allocation (widget, &allocation);
width = allocation.width - 12;
@@ -955,9 +960,11 @@ efhd_optional_button_show (GtkWidget *widget, GtkWidget *w)
static void
efhd_resize (GtkWidget *w, GtkAllocation *event, EMFormatHTML *efh)
{
+ EWebView *web_view;
GtkAllocation allocation;
- gtk_widget_get_allocation (GTK_WIDGET (efh->html), &allocation);
+ web_view = em_format_html_get_web_view (efh);
+ gtk_widget_get_allocation (GTK_WIDGET (web_view), &allocation);
gtk_widget_set_size_request (w, allocation.width - 48, 250);
}
@@ -972,6 +979,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
GtkAllocation allocation;
GtkTextBuffer *buffer;
GByteArray *byte_array;
+ EWebView *web_view;
/* FIXME: handle default shown case */
d(printf("adding attachment button/content for optional rendering\n"));
@@ -1041,7 +1049,8 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
gtk_box_pack_start(GTK_BOX (vbox), scroll, TRUE, TRUE, 6);
gtk_widget_show (GTK_WIDGET(view));
- gtk_widget_get_allocation (GTK_WIDGET (efh->html), &allocation);
+ web_view = em_format_html_get_web_view (efh);
+ gtk_widget_get_allocation (GTK_WIDGET (web_view), &allocation);
gtk_widget_set_size_request (scroll, allocation.width - 48, 250);
g_signal_connect (scroll, "size_allocate", G_CALLBACK(efhd_resize), efh);
gtk_widget_show (scroll);
diff --git a/mail/em-format-html-print.c b/mail/em-format-html-print.c
index 954254552c..e660602e46 100644
--- a/mail/em-format-html-print.c
+++ b/mail/em-format-html-print.c
@@ -65,16 +65,15 @@ static void
efhp_init (GObject *o)
{
EMFormatHTMLPrint *efhp = (EMFormatHTMLPrint *)o;
- GtkWidget *html = (GtkWidget *)efhp->parent.html;
+ EWebView *web_view;
- /* ?? */
- gtk_widget_set_name(html, "EvolutionMailPrintHTMLWidget");
+ web_view = em_format_html_get_web_view (EM_FORMAT_HTML (efhp));
/* gtk widgets don't like to be realized outside top level widget
so we put new html widget into gtk window */
efhp->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_add (GTK_CONTAINER (efhp->window), html);
- gtk_widget_realize (html);
+ gtk_container_add (GTK_CONTAINER (efhp->window), GTK_WIDGET (web_view));
+ gtk_widget_realize (GTK_WIDGET (web_view));
efhp->parent.show_icon = FALSE;
((EMFormat *)efhp)->print = TRUE;
}
@@ -190,12 +189,16 @@ static void
emfhp_complete (EMFormatHTMLPrint *efhp)
{
GtkPrintOperation *operation;
+ EWebView *web_view;
GError *error = NULL;
+ web_view = em_format_html_get_web_view (EM_FORMAT_HTML (efhp));
+
operation = e_print_operation_new ();
gtk_html_print_operation_run (
- efhp->parent.html, operation, efhp->action, NULL,
+ GTK_HTML (web_view),
+ operation, efhp->action, NULL,
(GtkHTMLPrintCalcHeight) NULL,
(GtkHTMLPrintCalcHeight) efhp_calc_footer_height,
(GtkHTMLPrintDrawFunc) NULL,
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index b88ba2802d..5454394e49 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -48,6 +48,7 @@
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
#include "e-util/e-extensible.h"
+#include "misc/e-web-view.h"
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
@@ -77,6 +78,8 @@ struct _EMFormatHTMLCache {
};
struct _EMFormatHTMLPrivate {
+ EWebView *web_view;
+
CamelMimeMessage *last_part; /* not reffed, DO NOT dereference */
volatile gint format_id; /* format thread id */
guint format_timeout_id;
@@ -109,7 +112,8 @@ enum {
PROP_ONLY_LOCAL_PHOTOS,
PROP_SHOW_SENDER_PHOTO,
PROP_SHOW_REAL_DATE,
- PROP_TEXT_COLOR
+ PROP_TEXT_COLOR,
+ PROP_WEB_VIEW
};
static void efh_url_requested(GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFormatHTML *efh);
@@ -156,7 +160,7 @@ efh_format_exec (struct _format_msg *m)
gint cancelled = FALSE;
CamelURL *base;
- if (m->format->html == NULL)
+ if (m->format->priv->web_view == NULL)
return;
format = EM_FORMAT (m->format);
@@ -213,7 +217,7 @@ efh_format_exec (struct _format_msg *m)
/* This is an implicit check to see if the gtkhtml has been destroyed */
if (!cancelled)
- cancelled = m->format->html == NULL;
+ cancelled = m->format->priv->web_view == NULL;
/* Now do an explicit check for user cancellation */
if (!cancelled)
@@ -296,8 +300,11 @@ efh_format_timeout(struct _format_msg *m)
GtkHTMLStream *hstream;
EMFormatHTML *efh = m->format;
struct _EMFormatHTMLPrivate *p = efh->priv;
+ EWebView *web_view;
+
+ web_view = em_format_html_get_web_view (m->format);
- if (m->format->html == NULL) {
+ if (web_view == NULL) {
mail_msg_unref(m);
return FALSE;
}
@@ -326,7 +333,7 @@ efh_format_timeout(struct _format_msg *m)
}
if (m->message == NULL) {
- hstream = gtk_html_begin(efh->html);
+ hstream = gtk_html_begin (GTK_HTML (web_view));
gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK);
mail_msg_unref(m);
p->last_part = NULL;
@@ -334,13 +341,14 @@ efh_format_timeout(struct _format_msg *m)
efh->state = EM_FORMAT_HTML_STATE_RENDERING;
if (p->last_part != m->message) {
- hstream = gtk_html_begin (efh->html);
+ hstream = gtk_html_begin (GTK_HTML (web_view));
gtk_html_stream_printf (hstream, "<h5>%s</h5>", _("Formatting Message..."));
gtk_html_stream_close (hstream, GTK_HTML_STREAM_OK);
}
hstream = NULL;
- m->estream = (EMHTMLStream *)em_html_stream_new(efh->html, hstream);
+ m->estream = (EMHTMLStream *)em_html_stream_new (
+ GTK_HTML (web_view), hstream);
if (p->last_part == m->message) {
em_html_stream_set_flags (m->estream,
@@ -385,9 +393,9 @@ efh_gtkhtml_destroy(GtkHTML *html, EMFormatHTML *efh)
if (efh->priv->format_id != -1)
mail_msg_cancel(efh->priv->format_id);
- if (efh->html != NULL) {
- g_object_unref (efh->html);
- efh->html = NULL;
+ if (efh->priv->web_view != NULL) {
+ g_object_unref (efh->priv->web_view);
+ efh->priv->web_view = NULL;
}
}
@@ -573,6 +581,12 @@ efh_get_property (GObject *object,
&color);
g_value_set_boxed (value, &color);
return;
+
+ case PROP_WEB_VIEW:
+ g_value_set_object (
+ value, em_format_html_get_web_view (
+ EM_FORMAT_HTML (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -586,7 +600,7 @@ efh_finalize (GObject *object)
/* FIXME: check for leaked stuff */
em_format_html_clear_pobject (efh);
- efh_gtkhtml_destroy (efh->html, efh);
+ efh_gtkhtml_destroy (GTK_HTML (efh->priv->web_view), efh);
g_hash_table_destroy (efh->priv->text_inline_parts);
@@ -606,7 +620,7 @@ efh_format_clone (EMFormat *emf,
/* How to sub-class ? Might need to adjust api ... */
- if (efh->html == NULL)
+ if (efh->priv->web_view == NULL)
return;
d(printf("efh_format called\n"));
@@ -761,7 +775,7 @@ efh_class_init (EMFormatHTMLClass *class)
format_class->format_secure = efh_format_secure;
format_class->busy = efh_busy;
- class->html_widget_type = GTK_TYPE_HTML;
+ class->html_widget_type = E_TYPE_WEB_VIEW;
g_object_class_install_property (
object_class,
@@ -879,6 +893,16 @@ efh_class_init (EMFormatHTMLClass *class)
GDK_TYPE_COLOR,
G_PARAM_READWRITE));
+ g_object_class_install_property (
+ object_class,
+ PROP_WEB_VIEW,
+ g_param_spec_object (
+ "web-view",
+ "Web View",
+ NULL,
+ E_TYPE_WEB_VIEW,
+ G_PARAM_READABLE));
+
/* cache expiry - 2 hour access, 1 day max */
pathname = g_build_filename (
e_get_user_data_dir (), "cache", NULL);
@@ -894,7 +918,7 @@ static void
efh_init (EMFormatHTML *efh,
EMFormatHTMLClass *class)
{
- GtkHTML *html;
+ EWebView *web_view;
GdkColor *color;
efh->priv = EM_FORMAT_HTML_GET_PRIVATE (efh);
@@ -908,19 +932,21 @@ efh_init (EMFormatHTML *efh,
(GDestroyNotify) NULL,
(GDestroyNotify) efh_free_cache);
- html = g_object_new (class->html_widget_type, NULL);
- efh->html = g_object_ref_sink (html);
+ web_view = g_object_new (class->html_widget_type, NULL);
+ efh->priv->web_view = g_object_ref_sink (web_view);
- gtk_html_set_blocking (html, FALSE);
- gtk_html_set_caret_first_focus_anchor (html, EFM_MESSAGE_START_ANAME);
- gtk_html_set_default_content_type (html, "text/html; charset=utf-8");
- gtk_html_set_editable (html, FALSE);
+ gtk_html_set_blocking (GTK_HTML (web_view), FALSE);
+ gtk_html_set_caret_first_focus_anchor (
+ GTK_HTML (web_view), EFM_MESSAGE_START_ANAME);
+ gtk_html_set_default_content_type (
+ GTK_HTML (web_view), "text/html; charset=utf-8");
+ e_web_view_set_editable (web_view, FALSE);
g_signal_connect (
- html, "url-requested",
+ web_view, "url-requested",
G_CALLBACK (efh_url_requested), efh);
g_signal_connect (
- html, "object-requested",
+ web_view, "object-requested",
G_CALLBACK (efh_object_requested), efh);
color = &efh->priv->colors[EM_FORMAT_HTML_COLOR_BODY];
@@ -988,6 +1014,14 @@ em_format_html_get_type (void)
return type;
}
+EWebView *
+em_format_html_get_web_view (EMFormatHTML *efh)
+{
+ g_return_val_if_fail (EM_IS_FORMAT_HTML (efh), NULL);
+
+ return efh->priv->web_view;
+}
+
void
em_format_html_load_images (EMFormatHTML *efh)
{
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index 26a6671cea..4e9b315765 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -30,7 +30,7 @@
#include <em-format/em-format.h>
#include <mail/mail-config.h>
-#include <gtkhtml/gtkhtml.h>
+#include <misc/e-web-view.h>
#include <gtkhtml/gtkhtml-embedded.h>
/* Standard GObject macros */
@@ -195,8 +195,6 @@ struct _EMFormatHTML {
EMFormat parent;
EMFormatHTMLPrivate *priv;
- GtkHTML *html;
-
GQueue pending_object_list;
GSList *headers;
@@ -217,6 +215,7 @@ struct _EMFormatHTMLClass {
};
GType em_format_html_get_type (void);
+EWebView * em_format_html_get_web_view (EMFormatHTML *efh);
void em_format_html_load_images (EMFormatHTML *efh);
void em_format_html_get_color (EMFormatHTML *efh,
EMFormatHTMLColorType type,
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ed6cef3779..3485e55818 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -367,10 +367,10 @@ em_utils_flag_for_followup (EMailReader *reader,
CamelFolder *folder,
GPtrArray *uids)
{
- EMFormatHTMLDisplay *html_display;
+ EShell *shell;
EShellSettings *shell_settings;
EShellBackend *shell_backend;
- EShell *shell;
+ EMFormatHTML *formatter;
GtkWidget *editor;
GtkWindow *window;
CamelTag *tags;
@@ -454,8 +454,8 @@ em_utils_flag_for_followup (EMailReader *reader,
camel_folder_thaw (folder);
camel_tag_list_free (&tags);
- html_display = e_mail_reader_get_html_display (reader);
- em_format_redraw (EM_FORMAT (html_display));
+ formatter = e_mail_reader_get_formatter (reader);
+ em_format_redraw (EM_FORMAT (formatter));
exit:
/* XXX We shouldn't be freeing this. */