[gtk+/refactor: 79/137] gtk/gtkcheckmenuitem.c: use accessor functions to access GtkWidget



commit d62804a1eee0088efa8827ff77f05c744b4e4f6e
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Aug 11 23:15:16 2010 +0200

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

 gtk/gtkcheckmenuitem.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index 55aa8f4..e930556 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -469,6 +469,8 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
 
   if (gtk_widget_is_drawable (widget))
     {
+      GtkAllocation allocation;
+      GtkStyle *style;
       guint border_width;
       guint offset;
       guint toggle_size;
@@ -476,6 +478,9 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
       guint horizontal_padding;
       guint indicator_size;
 
+      style = gtk_widget_get_style (widget);
+      gtk_widget_get_allocation (widget, &allocation);
+
       gtk_widget_style_get (widget,
  			    "toggle-spacing", &toggle_spacing,
  			    "horizontal-padding", &horizontal_padding,
@@ -484,26 +489,29 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
 
       toggle_size = GTK_MENU_ITEM (check_menu_item)->toggle_size;
       border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-      offset = border_width + widget->style->xthickness + 2;
+      offset = border_width + style->xthickness + 2;
 
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
 	{
-	  x = widget->allocation.x + offset + horizontal_padding +
+          x = allocation.x + offset + horizontal_padding +
 	    (toggle_size - toggle_spacing - indicator_size) / 2;
 	}
       else 
 	{
-	  x = widget->allocation.x + widget->allocation.width -
+          x = allocation.x + allocation.width -
 	    offset - horizontal_padding - toggle_size + toggle_spacing +
 	    (toggle_size - toggle_spacing - indicator_size) / 2;
 	}
-      
-      y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
+
+      y = allocation.y + (allocation.height - indicator_size) / 2;
 
       if (priv->active ||
 	  priv->always_show_toggle ||
 	  (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT))
 	{
+          GdkWindow *window;
+
+          window = gtk_widget_get_window (widget);
 	  state_type = gtk_widget_get_state (widget);
 	  
 	  if (priv->inconsistent)
@@ -518,14 +526,14 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
 
 	  if (priv->draw_as_radio)
 	    {
-	      gtk_paint_option (widget->style, widget->window,
+              gtk_paint_option (style, window,
 				state_type, shadow_type,
 				area, widget, "option",
 				x, y, indicator_size, indicator_size);
 	    }
 	  else
 	    {
-	      gtk_paint_check (widget->style, widget->window,
+              gtk_paint_check (style, window,
 			       state_type, shadow_type,
 			       area, widget, "check",
 			       x, y, indicator_size, indicator_size);



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