Load default chart CSS to AgApp’s private member, web_view_group
This will make sure at least one CSS is loaded for each web view created later.
This commit is contained in:
parent
3efb358a4f
commit
b8cc90912d
26
src/ag-app.c
26
src/ag-app.c
@ -337,6 +337,32 @@ ag_app_new(void)
|
|||||||
static void
|
static void
|
||||||
ag_app_init(AgApp *app)
|
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
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user