[gtksourceview] Add a "sourceview" css class to all views.



commit 537c720cd4a789766e7f3b1319f93d4bf99046b7
Author: Paolo Borelli <pborelli gnome org>
Date:   Thu Feb 4 21:08:08 2016 +0100

    Add a "sourceview" css class to all views.
    
    We do not want to set an element name because we want to inherit
    all textview styles from the theme. However applications may need
    a way to identify all sourceviews and style them.

 gtksourceview/gtksourceview.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 52b16e9..f027a2a 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -1239,6 +1239,8 @@ notify_buffer_cb (GtkSourceView *view)
 static void
 gtk_source_view_init (GtkSourceView *view)
 {
+       GtkStyleContext *context;
+
        GtkTargetList *target_list;
 
        view->priv = gtk_source_view_get_instance_private (view);
@@ -1279,6 +1281,9 @@ gtk_source_view_init (GtkSourceView *view)
                          "notify::buffer",
                          G_CALLBACK (notify_buffer_cb),
                          NULL);
+
+       context = gtk_widget_get_style_context (GTK_WIDGET (view));
+       gtk_style_context_add_class (context, "sourceview");
 }
 
 static void


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