[evolution/wip/webkit2] Read link/visited-link colors also from the style context flags



commit 0a73c6d29b015e089a8ec92ad3d32062a84077d3
Author: Milan Crha <mcrha redhat com>
Date:   Wed Mar 2 17:42:29 2016 +0100

    Read link/visited-link colors also from the style context flags

 e-util/e-html-editor-view.c |   14 ++++++++++----
 e-util/e-web-view.c         |   30 ++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 4 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 2a77611..9cc52cd 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -3516,23 +3516,29 @@ set_link_color (EHTMLEditorView *view)
                context, "link-color", &color, NULL);
 
        if (color == NULL) {
+               gboolean is_visited = strstr (name, "visited") != NULL;
+
                rgba.alpha = 1;
-               rgba.red = 0;
+               rgba.red = is_visited ? 1 : 0;
                rgba.green = 0;
-               rgba.blue = 1;
+               rgba.blue = is_visited ? 0 : 1;
+
+               #if GTK_CHECK_VERSION(3,12,0)
+               gtk_style_context_get_color (context, is_visited ? GTK_STATE_FLAG_VISITED : 
GTK_STATE_FLAG_LINK, &rgba);
+               #endif
        } else {
                rgba.alpha = 1;
                rgba.red = ((gdouble) color->red) / G_MAXUINT16;
                rgba.green = ((gdouble) color->green) / G_MAXUINT16;
                rgba.blue = ((gdouble) color->blue) / G_MAXUINT16;
+
+               gdk_color_free (color);
        }
 
         // This set_link_color needs to be called when the document is loaded
         // (so we will probably emit the signal from WebProcess to Evo when this
         // happens).
        e_html_editor_view_set_link_color (view, &rgba);
-
-       gdk_color_free (color);
 }
 */
 
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index 496cff5..35d1fab 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -3311,13 +3311,43 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
                        NULL);
 
                if (link == NULL) {
+                       #if GTK_CHECK_VERSION(3,12,0)
+                       GdkRGBA rgba;
+                       #endif
+
                        link = g_slice_new0 (GdkColor);
                        link->blue = G_MAXINT16;
+
+                       #if GTK_CHECK_VERSION(3,12,0)
+                       rgba.alpha = 1;
+                       rgba.red = 0;
+                       rgba.green = 0;
+                       rgba.blue = 1;
+
+                       gtk_style_context_get_color (context, GTK_STATE_FLAG_LINK, &rgba);
+
+                       e_rgba_to_color (&rgba, link);
+                       #endif
                }
 
                if (visited == NULL) {
+                       #if GTK_CHECK_VERSION(3,12,0)
+                       GdkRGBA rgba;
+                       #endif
+
                        visited = g_slice_new0 (GdkColor);
                        visited->red = G_MAXINT16;
+
+                       #if GTK_CHECK_VERSION(3,12,0)
+                       rgba.alpha = 1;
+                       rgba.red = 1;
+                       rgba.green = 0;
+                       rgba.blue = 0;
+
+                       gtk_style_context_get_color (context, GTK_STATE_FLAG_VISITED, &rgba);
+
+                       e_rgba_to_color (&rgba, visited);
+                       #endif
                }
 
                g_string_append_printf (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]