[gtk+] Avoid passing widgets around here



commit 98346cc2198ff9ebaf2a56178063f5fc46c4004c
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 24 07:46:15 2011 -0500

    Avoid passing widgets around here
    
    The style context is enough.

 gtk/gtkstyle.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index bf3a711..3c7e82d 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -3972,18 +3972,12 @@ gtk_paint_spinner (GtkStyle           *style,
 }
 
 static void
-get_cursor_color (GtkWidget *widget,
-                  gboolean   primary,
-                  GdkColor  *color)
+get_cursor_color (GtkStyleContext *context,
+                  gboolean         primary,
+                  GdkColor        *color)
 {
-  GtkStyleContext *context;
   GdkColor *style_color;
 
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (color != NULL);
-
-  context = gtk_widget_get_style_context (widget);
-
   gtk_style_context_get_style (context,
                                primary ? "cursor-color" : "secondary-cursor-color",
                                &style_color,
@@ -4022,7 +4016,11 @@ void
 _gtk_widget_get_cursor_color (GtkWidget *widget,
                               GdkColor  *color)
 {
-  get_cursor_color (widget, TRUE, color);
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (widget);
+
+  get_cursor_color (context, TRUE, color);
 }
 
 /**
@@ -4064,7 +4062,7 @@ gtk_draw_insertion_cursor (GtkWidget          *widget,
 
   context = gtk_widget_get_style_context (widget);
 
-  get_cursor_color (widget, is_primary, &color);
+  get_cursor_color (context, is_primary, &color);
   gdk_cairo_set_source_color (cr, &color);
 
   /* When changing the shape or size of the cursor here,



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