diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-04-13 00:21:57 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-04-13 00:21:57 +0800 |
commit | 1ae02fa69cfc1acceb0c50fea9b64c18563ecd93 (patch) | |
tree | 43335bc7bd0c54c5746ff22faf7afbe832bdb470 /widgets | |
parent | 9e69152ab3fdd6fe2d74f656db8afc3fa6950816 (diff) | |
download | gsoc2013-evolution-1ae02fa69cfc1acceb0c50fea9b64c18563ecd93.tar gsoc2013-evolution-1ae02fa69cfc1acceb0c50fea9b64c18563ecd93.tar.gz gsoc2013-evolution-1ae02fa69cfc1acceb0c50fea9b64c18563ecd93.tar.bz2 gsoc2013-evolution-1ae02fa69cfc1acceb0c50fea9b64c18563ecd93.tar.lz gsoc2013-evolution-1ae02fa69cfc1acceb0c50fea9b64c18563ecd93.tar.xz gsoc2013-evolution-1ae02fa69cfc1acceb0c50fea9b64c18563ecd93.tar.zst gsoc2013-evolution-1ae02fa69cfc1acceb0c50fea9b64c18563ecd93.zip |
Use link colors from GtkStyleContext
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/e-web-view.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index 7baf5bb5cd..99af4681fd 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -2860,6 +2860,8 @@ e_web_view_update_fonts(EWebView *web_view) PangoFontDescription *min_size, *ms, *vw; const gchar *styles[] = { "normal", "oblique", "italic" }; const gchar *smoothing = NULL; + GtkStyleContext *context; + GdkColor *link, *visited; ms = NULL; vw = NULL; @@ -2944,6 +2946,39 @@ e_web_view_update_fonts(EWebView *web_view) pango_font_description_get_weight (ms), styles[pango_font_description_get_style (ms)]); + context = gtk_widget_get_style_context (GTK_WIDGET (web_view)); + gtk_style_context_get_style (context, + "link-color", &link, + "visited-link-color", &visited, + NULL); + + if (!link) { + link = g_new0 (GdkColor, 1); + link->blue = G_MAXINT16; + } + + if (!visited) { + visited = g_new0 (GdkColor, 1); + visited->red = G_MAXINT16; + } + + g_string_append_printf (stylesheet, + "a {\n" + " color: #%06x;\n" + "}\n" + "a:visited {\n" + " color: #%06x;\n" + "}\n", + e_color_to_value (link), + e_color_to_value (visited)); + + if (link) + gdk_color_free (link); + + if (visited) + gdk_color_free (visited); + + base64 = g_base64_encode ((guchar *) stylesheet->str, stylesheet->len); g_string_free (stylesheet, TRUE); |