From b8cc90912dd5cee2fed986ebb4bee5b589d04c51 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 10 Jul 2014 23:24:33 +0200 Subject: [PATCH] =?UTF-8?q?Load=20default=20chart=20CSS=20to=20AgApp?= =?UTF-8?q?=E2=80=99s=20private=20member,=20web=5Fview=5Fgroup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make sure at least one CSS is loaded for each web view created later. --- src/ag-app.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/ag-app.c b/src/ag-app.c index a4d3d13..c75319c 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -337,6 +337,32 @@ ag_app_new(void) static void ag_app_init(AgApp *app) { + AgAppPrivate *priv; + GBytes *css_data; + const gchar *css_source; + gsize css_length; + + priv = ag_app_get_instance_private(app); + priv->web_view_group = webkit_web_view_group_new(NULL); + + css_data = g_resources_lookup_data( + "/eu/polonkai/gergely/Astrognome/ui/chart-default.css", + G_RESOURCE_LOOKUP_FLAGS_NONE, + NULL + ); + + if ((css_source = g_bytes_get_data(css_data, &css_length)) != NULL) { + webkit_web_view_group_add_user_style_sheet( + priv->web_view_group, + css_source, + NULL, + NULL, + NULL, + WEBKIT_INJECTED_CONTENT_FRAMES_TOP_ONLY + ); + } + + g_bytes_unref(css_data); } static void