[gtksourceview] gtksourcestylescheme: re-apply CSS when parent style is set
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] gtksourcestylescheme: re-apply CSS when parent style is set
- Date: Fri, 15 Feb 2019 21:24:21 +0000 (UTC)
commit 688855e0b8e64e67d147aac191c3b747634cb1a1
Author: Christian Hergert <chergert redhat com>
Date: Fri Feb 15 13:22:13 2019 -0800
gtksourcestylescheme: re-apply CSS when parent style is set
We generate the CSS before the parent_id has been resolved into a pointer
for another style within the style manager. That means we have cached
values that are incorrect.
This updates the CSS when the parent pointer is set so that the background
and other text styles are updated correctly in the CSS provider.
Fixes #37
gtksourceview/gtksourcestylescheme.c | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index d3232854..667b6b46 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -1440,6 +1440,11 @@ _gtk_source_style_scheme_set_parent (GtkSourceStyleScheme *scheme,
g_return_if_fail (GTK_SOURCE_IS_STYLE_SCHEME (scheme));
g_return_if_fail (parent_scheme == NULL || GTK_SOURCE_IS_STYLE_SCHEME (parent_scheme));
+ if (scheme->priv->parent == parent_scheme)
+ {
+ return;
+ }
+
g_clear_object (&scheme->priv->parent);
if (parent_scheme != NULL)
@@ -1448,6 +1453,10 @@ _gtk_source_style_scheme_set_parent (GtkSourceStyleScheme *scheme,
}
scheme->priv->parent = parent_scheme;
+
+ /* Update CSS based on parent styles */
+ g_hash_table_remove_all (scheme->priv->style_cache);
+ generate_css_style (scheme);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]