[gtk+] Make gtk_style_new() use a backing GtkStyleContext



commit 33cd32f7968fb4e54d6f4f8e6e5c9910fba9fb20
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Dec 20 17:10:27 2010 +0100

    Make gtk_style_new() use a backing GtkStyleContext
    
    Fixes a bug in mutter where it would resort to a dummy style
    to get iconview rubberband color.
    
    Reported by Mathieu Bridon in
    https://bugzilla.gnome.org/show_bug.cgi?id=637520

 gtk/gtkstyle.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 419b098..e02beb5 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -809,10 +809,24 @@ gtk_style_copy (GtkStyle *style)
 GtkStyle*
 gtk_style_new (void)
 {
+  GtkStyleContext *context;
+  GtkWidgetPath *path;
   GtkStyle *style;
-  
-  style = g_object_new (GTK_TYPE_STYLE, NULL);
-  
+
+  context = gtk_style_context_new ();
+  gtk_style_context_set_screen (context, gdk_screen_get_default ());
+
+  path = gtk_widget_path_new ();
+  gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
+  gtk_style_context_set_path (context, path);
+
+  style = g_object_new (GTK_TYPE_STYLE,
+                        "context", context,
+                        NULL);
+
+  g_object_unref (context);
+  gtk_widget_path_free (path);
+
   return style;
 }
 



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