diff options
Diffstat (limited to 'e-util')
| -rw-r--r-- | e-util/e-html-editor-view.c | 101 | ||||
| -rw-r--r-- | e-util/e-web-view.c | 165 |
2 files changed, 72 insertions, 194 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index c46560f3b4..940f38eadb 100644 --- a/e-util/e-html-editor-view.c +++ b/e-util/e-html-editor-view.c @@ -80,6 +80,7 @@ struct _EHTMLEditorViewPrivate { GHashTable *inline_images; + GSettings *mail_settings; GSettings *font_settings; GSettings *aliasing_settings; @@ -239,6 +240,9 @@ e_html_editor_view_force_spell_check_for_current_paragraph (EHTMLEditorView *vie WebKitDOMRange *end_range, *actual; WebKitDOMText *text; + if (!view->priv->inline_spelling) + return; + document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view)); window = webkit_dom_document_get_default_view (document); dom_selection = webkit_dom_dom_window_get_selection (window); @@ -431,7 +435,8 @@ e_html_editor_view_turn_spell_check_off (EHTMLEditorView *view) void e_html_editor_view_force_spell_check (EHTMLEditorView *view) { - refresh_spell_check (view, TRUE); + if (view->priv->inline_spelling) + refresh_spell_check (view, TRUE); } static gint @@ -1158,6 +1163,9 @@ html_editor_view_load_status_changed (EHTMLEditorView *view) if (view->priv->html_mode) change_cid_images_src_to_base64 (view); + + if (!view->priv->inline_spelling) + e_html_editor_view_turn_spell_check_off (view); } /* Based on original use_pictograms() from GtkHTML */ @@ -2044,21 +2052,23 @@ html_editor_view_dispose (GObject *object) } if (priv->aliasing_settings != NULL) { - g_signal_handlers_disconnect_matched ( - priv->aliasing_settings, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, object); + g_signal_handlers_disconnect_by_data (priv->aliasing_settings, object); g_object_unref (priv->aliasing_settings); priv->aliasing_settings = NULL; } if (priv->font_settings != NULL) { - g_signal_handlers_disconnect_matched ( - priv->font_settings, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, object); + g_signal_handlers_disconnect_by_data (priv->font_settings, object); g_object_unref (priv->font_settings); priv->font_settings = NULL; } + if (priv->mail_settings != NULL) { + g_signal_handlers_disconnect_by_data (priv->mail_settings, object); + g_object_unref (priv->mail_settings); + priv->mail_settings = NULL; + } + g_hash_table_remove_all (priv->inline_images); /* Chain up to parent's dispose() method. */ @@ -4646,6 +4656,9 @@ e_html_editor_view_init (EHTMLEditorView *view) G_CALLBACK (e_html_editor_settings_changed_cb), view); view->priv->font_settings = g_settings; + g_settings = g_settings_new ("org.gnome.evolution.mail"); + view->priv->mail_settings = g_settings; + /* This schema is optional. Use if available. */ settings_schema = g_settings_schema_source_lookup ( g_settings_schema_source_get_default (), @@ -6551,6 +6564,11 @@ e_html_editor_view_set_inline_spelling (EHTMLEditorView *view, view->priv->inline_spelling = inline_spelling; + if (inline_spelling) + e_html_editor_view_force_spell_check (view); + else + e_html_editor_view_turn_spell_check_off (view); + g_object_notify (G_OBJECT (view), "inline-spelling"); } @@ -6905,33 +6923,47 @@ citation_color_level_5 (void) void e_html_editor_view_update_fonts (EHTMLEditorView *view) { - GString *stylesheet; - gchar *base64; - gchar *aa = NULL; - WebKitWebSettings *settings; - PangoFontDescription *ms, *vw; + gboolean mark_citations, use_custom_font; + GdkColor *link = NULL; + GdkColor *visited = NULL; + gchar *base64, *font, *aa = NULL, *citation_color; const gchar *styles[] = { "normal", "oblique", "italic" }; const gchar *smoothing = NULL; + GString *stylesheet; GtkStyleContext *context; - GdkColor *link = NULL; - GdkColor *visited = NULL; - gchar *font; + PangoFontDescription *ms, *vw; + WebKitWebSettings *settings; - font = g_settings_get_string ( - view->priv->font_settings, - "monospace-font-name"); - ms = pango_font_description_from_string ( - font ? font : "monospace 10"); - g_free (font); + g_return_if_fail (E_IS_HTML_EDITOR_VIEW (view)); - if (view->priv->html_mode) { + use_custom_font = g_settings_get_boolean ( + view->priv->mail_settings, "use-custom-font"); + + if (use_custom_font) { font = g_settings_get_string ( - view->priv->font_settings, - "font-name"); - vw = pango_font_description_from_string ( - font ? font : "serif 10"); + view->priv->mail_settings, "monospace-font"); + ms = pango_font_description_from_string (font ? font : "monospace 10"); g_free (font); } else { + font = g_settings_get_string ( + view->priv->font_settings, "monospace-font-name"); + ms = pango_font_description_from_string (font ? font : "monospace 10"); + g_free (font); + } + + if (view->priv->html_mode) { + if (use_custom_font) { + font = g_settings_get_string ( + view->priv->mail_settings, "variable-width-font"); + vw = pango_font_description_from_string (font ? font : "serif 10"); + g_free (font); + } else { + font = g_settings_get_string ( + view->priv->font_settings, "font-name"); + vw = pango_font_description_from_string (font ? font : "serif 10"); + g_free (font); + } + } else { /* When in plain text mode, force monospace font */ vw = pango_font_description_copy (ms); } @@ -7092,6 +7124,11 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view) " -webkit-margin-after: 0em; \n" "}\n"); + citation_color = g_settings_get_string ( + view->priv->mail_settings, "citation-color"); + mark_citations = g_settings_get_boolean ( + view->priv->mail_settings, "mark-citations"); + g_string_append ( stylesheet, "blockquote[type=cite] " @@ -7099,9 +7136,15 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view) " padding: 0.0ex 0ex;\n" " margin: 0ex;\n" " -webkit-margin-start: 0em; \n" - " -webkit-margin-end : 0em; \n" - " color: #737373 !important;\n" - "}\n"); + " -webkit-margin-end : 0em; \n"); + + if (mark_citations && citation_color) + g_string_append_printf ( + stylesheet, + " color: %s !important; \n", + citation_color); + + g_string_append (stylesheet, "}\n"); g_string_append ( stylesheet, diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c index fb644418db..ed8324c1b1 100644 --- a/e-util/e-web-view.c +++ b/e-util/e-web-view.c @@ -86,9 +86,6 @@ enum { PROP_CURSOR_IMAGE_SRC, PROP_DISABLE_PRINTING, PROP_DISABLE_SAVE_TO_DISK, - PROP_INLINE_SPELLING, - PROP_MAGIC_LINKS, - PROP_MAGIC_SMILEYS, PROP_OPEN_PROXY, PROP_PRINT_PROXY, PROP_SAVE_AS_PROXY, @@ -712,24 +709,6 @@ web_view_set_property (GObject *object, g_value_get_boolean (value)); return; - case PROP_INLINE_SPELLING: - e_web_view_set_inline_spelling ( - E_WEB_VIEW (object), - g_value_get_boolean (value)); - return; - - case PROP_MAGIC_LINKS: - e_web_view_set_magic_links ( - E_WEB_VIEW (object), - g_value_get_boolean (value)); - return; - - case PROP_MAGIC_SMILEYS: - e_web_view_set_magic_smileys ( - E_WEB_VIEW (object), - g_value_get_boolean (value)); - return; - case PROP_OPEN_PROXY: e_web_view_set_open_proxy ( E_WEB_VIEW (object), @@ -788,24 +767,6 @@ web_view_get_property (GObject *object, E_WEB_VIEW (object))); return; - case PROP_INLINE_SPELLING: - g_value_set_boolean ( - value, e_web_view_get_inline_spelling ( - E_WEB_VIEW (object))); - return; - - case PROP_MAGIC_LINKS: - g_value_set_boolean ( - value, e_web_view_get_magic_links ( - E_WEB_VIEW (object))); - return; - - case PROP_MAGIC_SMILEYS: - g_value_set_boolean ( - value, e_web_view_get_magic_smileys ( - E_WEB_VIEW (object))); - return; - case PROP_OPEN_PROXY: g_value_set_object ( value, e_web_view_get_open_proxy ( @@ -1522,36 +1483,6 @@ e_web_view_class_init (EWebViewClass *class) g_object_class_install_property ( object_class, - PROP_INLINE_SPELLING, - g_param_spec_boolean ( - "inline-spelling", - "Inline Spelling", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_MAGIC_LINKS, - g_param_spec_boolean ( - "magic-links", - "Magic Links", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_MAGIC_SMILEYS, - g_param_spec_boolean ( - "magic-smileys", - "Magic Smileys", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, PROP_OPEN_PROXY, g_param_spec_object ( "open-proxy", @@ -2116,102 +2047,6 @@ e_web_view_set_editable (EWebView *web_view, webkit_web_view_set_editable (WEBKIT_WEB_VIEW (web_view), editable); } -gboolean -e_web_view_get_inline_spelling (EWebView *web_view) -{ -#if 0 /* WEBKIT - XXX No equivalent property? */ - /* XXX This is just here to maintain symmetry - * with e_web_view_set_inline_spelling(). */ - - g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE); - - return gtk_html_get_inline_spelling (GTK_HTML (web_view)); -#endif - - return FALSE; -} - -void -e_web_view_set_inline_spelling (EWebView *web_view, - gboolean inline_spelling) -{ -#if 0 /* WEBKIT - XXX No equivalent property? */ - /* XXX GtkHTML does not utilize GObject properties as well - * as it could. This just wraps gtk_html_set_inline_spelling() - * so we get a "notify::inline-spelling" signal. */ - - g_return_if_fail (E_IS_WEB_VIEW (web_view)); - - gtk_html_set_inline_spelling (GTK_HTML (web_view), inline_spelling); - - g_object_notify (G_OBJECT (web_view), "inline-spelling"); -#endif -} - -gboolean -e_web_view_get_magic_links (EWebView *web_view) -{ -#if 0 /* WEBKIT - XXX No equivalent property? */ - /* XXX This is just here to maintain symmetry - * with e_web_view_set_magic_links(). */ - - g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE); - - return gtk_html_get_magic_links (GTK_HTML (web_view)); -#endif - - return FALSE; -} - -void -e_web_view_set_magic_links (EWebView *web_view, - gboolean magic_links) -{ -#if 0 /* WEBKIT - XXX No equivalent property? */ - /* XXX GtkHTML does not utilize GObject properties as well - * as it could. This just wraps gtk_html_set_magic_links() - * so we can get a "notify::magic-links" signal. */ - - g_return_if_fail (E_IS_WEB_VIEW (web_view)); - - gtk_html_set_magic_links (GTK_HTML (web_view), magic_links); - - g_object_notify (G_OBJECT (web_view), "magic-links"); -#endif -} - -gboolean -e_web_view_get_magic_smileys (EWebView *web_view) -{ -#if 0 /* WEBKIT - No equivalent property? */ - /* XXX This is just here to maintain symmetry - * with e_web_view_set_magic_smileys(). */ - - g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE); - - return gtk_html_get_magic_smileys (GTK_HTML (web_view)); -#endif - - return FALSE; -} - -void -e_web_view_set_magic_smileys (EWebView *web_view, - gboolean magic_smileys) -{ -#if 0 /* WEBKIT - No equivalent property? */ - /* XXX GtkHTML does not utilize GObject properties as well - * as it could. This just wraps gtk_html_set_magic_smileys() - * so we can get a "notify::magic-smileys" signal. */ - - g_return_if_fail (E_IS_WEB_VIEW (web_view)); - - gtk_html_set_magic_smileys (GTK_HTML (web_view), magic_smileys); - - g_object_notify (G_OBJECT (web_view), "magic-smileys"); -#endif -} - const gchar * e_web_view_get_selected_uri (EWebView *web_view) { |
