[gtksourceview] style-scheme: use lower priority than APPLICATION for CSS overrides



commit d3cf6804335e23eb7f35d9d5909323bb1c684f57
Author: Christian Hergert <christian hergert me>
Date:   Thu May 21 14:32:43 2015 -0700

    style-scheme: use lower priority than APPLICATION for CSS overrides
    
    Using the APPLICATION level priority doesn't allow applications to
    override things appropriately. Additionally, it also causes the minimap
    to not be able to define a scrubber style without raising the
    priority to higher than APPLICATION.
    
    This uses a define so that we can access the value from the minimap
    as well.

 gtksourceview/gtksourcestyle-private.h |    7 +++++++
 gtksourceview/gtksourcestylescheme.c   |    4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcestyle-private.h b/gtksourceview/gtksourcestyle-private.h
index 8334081..1864648 100644
--- a/gtksourceview/gtksourcestyle-private.h
+++ b/gtksourceview/gtksourcestyle-private.h
@@ -27,6 +27,13 @@
 
 G_BEGIN_DECLS
 
+/*
+ * We need to be lower than the application priority to allow
+ * application overrides. And we need enough room for
+ * GtkSourceMap to be able to override the style priority.
+ */
+#define GTK_SOURCE_STYLE_PROVIDER_PRIORITY (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION-2)
+
 enum
 {
        GTK_SOURCE_STYLE_USE_LINE_BACKGROUND = 1 << 0,  /*< nick=use_line_background >*/
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index d7cb00a..a40c68e 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -744,7 +744,7 @@ _gtk_source_style_scheme_apply (GtkSourceStyleScheme *scheme,
        context = gtk_widget_get_style_context (GTK_WIDGET (widget));
        gtk_style_context_add_provider (context,
                                        GTK_STYLE_PROVIDER (scheme->priv->css_provider),
-                                       GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+                                       GTK_SOURCE_STYLE_PROVIDER_PRIORITY);
 
        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
        /* See https://bugzilla.gnome.org/show_bug.cgi?id=708583 */
@@ -763,7 +763,7 @@ _gtk_source_style_scheme_apply (GtkSourceStyleScheme *scheme,
        {
                gtk_style_context_add_provider (context,
                                                GTK_STYLE_PROVIDER (scheme->priv->css_provider_cursors),
-                                               GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+                                               GTK_SOURCE_STYLE_PROVIDER_PRIORITY);
 
                G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
                gtk_style_context_invalidate (context);


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