[gtksourceview/wip/fix-deprecations] StyleScheme: style cursors with CSS (not finished)



commit 42b46050da3e30dc43b012b49e3e19b0dcefd349
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Nov 26 21:59:16 2014 +0100

    StyleScheme: style cursors with CSS (not finished)
    
    To avoid using deprecated GTK+ functions.
    
    CSS example:
    
    GtkSourceView {
            -GtkWidget-cursor-color: red;
            -GtkWidget-secondary-cursor-color: green;
    }

 gtksourceview/gtksourcestylescheme.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 56278a1..6c7b5b2 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -709,10 +709,6 @@ _gtk_source_style_scheme_apply (GtkSourceStyleScheme *scheme,
        /* See https://bugzilla.gnome.org/show_bug.cgi?id=708583 */
        gtk_style_context_invalidate (context);
        G_GNUC_END_IGNORE_DEPRECATIONS;
-
-       style = gtk_source_style_scheme_get_style (scheme, STYLE_CURSOR);
-       style2 = gtk_source_style_scheme_get_style (scheme, STYLE_SECONDARY_CURSOR);
-       update_cursor_colors (widget, style, style2);
 }
 
 /**
@@ -741,8 +737,6 @@ _gtk_source_style_scheme_unapply (GtkSourceStyleScheme *scheme,
        /* See https://bugzilla.gnome.org/show_bug.cgi?id=708583 */
        gtk_style_context_invalidate (context);
        G_GNUC_END_IGNORE_DEPRECATIONS;
-
-       update_cursor_colors (widget, NULL, NULL);
 }
 
 /* --- PARSER ---------------------------------------------------------------- */
@@ -824,6 +818,12 @@ generate_css_style (GtkSourceStyleScheme *scheme)
                style2 = style;
        append_css_style (final_style, style2, ".view:selected");
 
+       /* TODO cursor style here */
+       style = gtk_source_style_scheme_get_style (scheme, STYLE_CURSOR);
+       style2 = gtk_source_style_scheme_get_style (scheme, STYLE_SECONDARY_CURSOR);
+       append_css_style (final_style, style, "??");
+       update_cursor_colors (widget, style, style2);
+
        /* For now we use "line numbers" colors for all the gutters */
        style = gtk_source_style_scheme_get_style (scheme, STYLE_LINE_NUMBERS);
        if (style != NULL)


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