diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-05-31 22:24:14 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-06-01 00:01:49 +0800 |
commit | 4f01d3d1823fd8d7b53919b03ff44cc46ad92b77 (patch) | |
tree | 93b7541b92635862399d7783cb2fed77cee74ef5 /modules/mail | |
parent | 3d9b0002c5802e3d8c3a426221bfb5294691326e (diff) | |
download | gsoc2013-evolution-4f01d3d1823fd8d7b53919b03ff44cc46ad92b77.tar.gz gsoc2013-evolution-4f01d3d1823fd8d7b53919b03ff44cc46ad92b77.tar.zst gsoc2013-evolution-4f01d3d1823fd8d7b53919b03ff44cc46ad92b77.zip |
Keep chipping away at direct GtkHTML usage.
EMFormatHTML now holds a sealed EWebView instead of a public GtkHTML,
accessible through em_format_html_get_web_view().
Rename e_mail_reader_get_html_display() to e_mail_reader_get_formatter()
and have it return an EMFormatHTML instead of an EMFormatHTMLDisplay,
since that's usually the type you want (or else an EMFormat, but never
an EMFormatHTMLDisplay).
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 8 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 37 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 20 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 6 |
4 files changed, 38 insertions, 33 deletions
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 5c16a34b21..ecb11e769d 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -781,13 +781,17 @@ static void mbox_create_preview_cb (GObject *preview, GtkWidget **preview_widget) { EMFormatHTMLDisplay *format; + EWebView *web_view; g_return_if_fail (preview != NULL); g_return_if_fail (preview_widget != NULL); format = em_format_html_display_new (); - g_object_set_data_full (preview, "mbox-imp-formatter", format, g_object_unref); - *preview_widget = GTK_WIDGET (EM_FORMAT_HTML (format)->html); + g_object_set_data_full ( + preview, "mbox-imp-formatter", format, g_object_unref); + web_view = em_format_html_get_web_view (EM_FORMAT_HTML (format)); + + *preview_widget = GTK_WIDGET (web_view); } static void diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index d029b469b3..5d5ee14e3a 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -57,7 +57,7 @@ struct _EMailShellContentPrivate { GtkWidget *message_list; GtkWidget *search_bar; - EMFormatHTMLDisplay *html_display; + EMFormatHTMLDisplay *formatter; GalViewInstance *view_instance; GtkOrientation orientation; @@ -370,9 +370,9 @@ mail_shell_content_dispose (GObject *object) priv->search_bar = 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->view_instance != NULL) { @@ -400,7 +400,7 @@ mail_shell_content_constructed (GObject *object) EWebView *web_view; priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); - priv->html_display = em_format_html_display_new (); + priv->formatter = em_format_html_display_new (); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); @@ -410,7 +410,8 @@ mail_shell_content_constructed (GObject *object) shell_window = e_shell_view_get_shell_window (shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); - web_view = E_WEB_VIEW (EM_FORMAT_HTML (priv->html_display)->html); + web_view = em_format_html_get_web_view ( + EM_FORMAT_HTML (priv->formatter)); /* Build content widgets. */ @@ -457,7 +458,7 @@ mail_shell_content_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); /* Load the view instance. */ @@ -504,24 +505,24 @@ mail_shell_content_get_action_group (EMailReader *reader) return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window); } -static gboolean -mail_shell_content_get_hide_deleted (EMailReader *reader) +static EMFormatHTML * +mail_shell_content_get_formatter (EMailReader *reader) { - EMailShellContent *mail_shell_content; + EMailShellContentPrivate *priv; - mail_shell_content = E_MAIL_SHELL_CONTENT (reader); + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - return !e_mail_shell_content_get_show_deleted (mail_shell_content); + return EM_FORMAT_HTML (priv->formatter); } -static EMFormatHTMLDisplay * -mail_shell_content_get_html_display (EMailReader *reader) +static gboolean +mail_shell_content_get_hide_deleted (EMailReader *reader) { - EMailShellContentPrivate *priv; + EMailShellContent *mail_shell_content; - priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + mail_shell_content = E_MAIL_SHELL_CONTENT (reader); - return priv->html_display; + return !e_mail_shell_content_get_show_deleted (mail_shell_content); } static GtkWidget * @@ -736,8 +737,8 @@ static void mail_shell_content_reader_init (EMailReaderIface *iface) { iface->get_action_group = mail_shell_content_get_action_group; + iface->get_formatter = mail_shell_content_get_formatter; iface->get_hide_deleted = mail_shell_content_get_hide_deleted; - iface->get_html_display = mail_shell_content_get_html_display; iface->get_message_list = mail_shell_content_get_message_list; iface->get_popup_menu = mail_shell_content_get_popup_menu; iface->get_shell_backend = mail_shell_content_get_shell_backend; diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 63b5b4f400..720f2da87e 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -594,11 +594,11 @@ action_mail_smart_backward_cb (GtkAction *action, EShellSettings *shell_settings; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; - EMFormatHTMLDisplay *html_display; + EMFormatHTML *formatter; EMailReader *reader; GtkWidget *message_list; GtkToggleAction *toggle_action; - GtkHTML *html; + EWebView *web_view; gboolean caret_mode; gboolean magic_spacebar; @@ -613,7 +613,7 @@ action_mail_smart_backward_cb (GtkAction *action, folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - 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); magic_spacebar = e_shell_settings_get_boolean ( @@ -622,9 +622,9 @@ action_mail_smart_backward_cb (GtkAction *action, toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE)); caret_mode = gtk_toggle_action_get_active (toggle_action); - html = EM_FORMAT_HTML (html_display)->html; + web_view = em_format_html_get_web_view (formatter); - if (e_web_view_scroll_backward (E_WEB_VIEW (html))) + if (e_web_view_scroll_backward (web_view)) return; if (caret_mode || !magic_spacebar) @@ -660,11 +660,11 @@ action_mail_smart_forward_cb (GtkAction *action, EShellSettings *shell_settings; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; - EMFormatHTMLDisplay *html_display; + EMFormatHTML *formatter; EMailReader *reader; GtkWidget *message_list; GtkToggleAction *toggle_action; - GtkHTML *html; + EWebView *web_view; gboolean caret_mode; gboolean magic_spacebar; @@ -679,7 +679,7 @@ action_mail_smart_forward_cb (GtkAction *action, folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - 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); magic_spacebar = e_shell_settings_get_boolean ( @@ -688,9 +688,9 @@ action_mail_smart_forward_cb (GtkAction *action, toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE)); caret_mode = gtk_toggle_action_get_active (toggle_action); - html = EM_FORMAT_HTML (html_display)->html; + web_view = em_format_html_get_web_view (formatter); - if (e_web_view_scroll_forward (E_WEB_VIEW (html))) + if (e_web_view_scroll_forward (web_view)) return; if (caret_mode || !magic_spacebar) diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 42394b2f53..b3e856fdee 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -419,7 +419,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) EShellTaskbar *shell_taskbar; EShellWindow *shell_window; EShellSearchbar *searchbar; - EMFormatHTMLDisplay *html_display; + EMFormatHTML *formatter; EMFolderTree *folder_tree; EActionComboBox *combo_box; ERuleContext *context; @@ -462,7 +462,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) priv->mail_shell_sidebar = g_object_ref (shell_sidebar); reader = E_MAIL_READER (shell_content); - 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); mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); @@ -480,7 +480,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) folder_tree, "sensitive", combo_box, "sensitive"); - web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); + web_view = em_format_html_get_web_view (formatter); g_signal_connect_swapped ( folder_tree, "folder-selected", |