[gtk+/refactor: 38/96] gtk/gtkradiobutton.c: use accessor functions to access GtkWidget



commit e30bffbe3f155a9ddccddae806ce28a4a5b8c7a9
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Aug 11 23:03:29 2010 +0200

    gtk/gtkradiobutton.c: use accessor functions to access GtkWidget

 gtk/gtkradiobutton.c |   40 ++++++++++++++++++++++++++--------------
 1 files changed, 26 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 675c29a..ebaa86c 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -545,9 +545,12 @@ get_coordinates (GtkWidget    *widget,
 		 gint         *x,
 		 gint         *y)
 {
-  *x = widget->allocation.x + widget->allocation.width / 2;
-  *y = widget->allocation.y + widget->allocation.height / 2;
-  
+  GtkAllocation allocation;
+
+  gtk_widget_get_allocation (widget, &allocation);
+  *x = allocation.x + allocation.width / 2;
+  *y = allocation.y + allocation.height / 2;
+
   gtk_widget_translate_coordinates (widget, reference, *x, *y, x, y);
 }
 
@@ -813,12 +816,15 @@ static void
 gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
 				 GdkRectangle   *area)
 {
+  GtkAllocation allocation;
   GtkWidget *widget;
   GtkWidget *child;
   GtkButton *button;
   GtkToggleButton *toggle_button;
   GtkStateType state_type;
   GtkShadowType shadow_type;
+  GtkStyle *style;
+  GdkWindow *window;
   gint x, y;
   gint indicator_size, indicator_spacing;
   gint focus_width;
@@ -835,16 +841,21 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
 
       border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
+      style = gtk_widget_get_style (widget);
       gtk_widget_style_get (widget,
 			    "interior-focus", &interior_focus,
 			    "focus-line-width", &focus_width,
 			    "focus-padding", &focus_pad,
 			    NULL);
 
+      window = gtk_widget_get_window (widget);
+
       _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
 
-      x = widget->allocation.x + indicator_spacing + border_width;
-      y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
+      gtk_widget_get_allocation (widget, &allocation);
+
+      x = allocation.x + indicator_spacing + border_width;
+      y = allocation.y + (allocation.height - indicator_size) / 2;
 
       child = gtk_bin_get_child (GTK_BIN (check_button));
       if (!interior_focus || !(child && gtk_widget_get_visible (child)))
@@ -867,21 +878,22 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
 	state_type = GTK_STATE_NORMAL;
 
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-	x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
+	x = allocation.x + allocation.width - (indicator_size + x - allocation.x);
 
       if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
 	{
 	  GdkRectangle restrict_area;
 	  GdkRectangle new_area;
-	      
-	  restrict_area.x = widget->allocation.x + border_width;
-	  restrict_area.y = widget->allocation.y + border_width;
-	  restrict_area.width = widget->allocation.width - (2 * border_width);
-	  restrict_area.height = widget->allocation.height - (2 * border_width);
-	  
+
+	  restrict_area.x = allocation.x + border_width;
+	  restrict_area.y = allocation.y + border_width;
+	  restrict_area.width = allocation.width - (2 * border_width);
+	  restrict_area.height = allocation.height - (2 * border_width);
+
 	  if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
 	    {
-	      gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
+              gtk_paint_flat_box (style, window,
+                                  GTK_STATE_PRELIGHT,
 				  GTK_SHADOW_ETCHED_OUT, 
 				  area, widget, "checkbutton",
 				  new_area.x, new_area.y,
@@ -889,7 +901,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
 	    }
 	}
 
-      gtk_paint_option (widget->style, widget->window,
+      gtk_paint_option (style, window,
 			state_type, shadow_type,
 			area, widget, "radiobutton",
 			x, y, indicator_size, indicator_size);



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