[gtk+/refactor: 6/23] gtk/gtkimage.c: use accessor functions to access GtkWidget



commit 33819bca5831891b54d433dfa1f716a20e26d8a6
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Aug 11 23:10:44 2010 +0200

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

 gtk/gtkimage.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 2a41329..f378242 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1518,13 +1518,15 @@ animation_timeout (gpointer data)
   delay = gdk_pixbuf_animation_iter_get_delay_time (priv->data.anim.iter);
   if (delay >= 0)
     {
+      GtkWidget *widget = GTK_WIDGET (image);
+
       priv->data.anim.frame_timeout =
         gdk_threads_add_timeout (delay, animation_timeout, image);
 
-      gtk_widget_queue_draw (GTK_WIDGET (image));
+      gtk_widget_queue_draw (widget);
 
-      if (gtk_widget_is_drawable (GTK_WIDGET (image)))
-        gdk_window_process_updates (GTK_WIDGET (image)->window, TRUE);
+      if (gtk_widget_is_drawable (widget))
+        gdk_window_process_updates (gtk_widget_get_window (widget), TRUE);
     }
 
   return FALSE;
@@ -1789,7 +1791,9 @@ gtk_image_expose (GtkWidget      *widget,
   if (gtk_widget_get_mapped (widget) &&
       priv->storage_type != GTK_IMAGE_EMPTY)
     {
+      GtkAllocation allocation;
       GtkMisc *misc;
+      GtkRequisition requisition;
       GdkRectangle area, image_bound;
       gint x, y, mask_x, mask_y;
       gint xpad, ypad;
@@ -1809,8 +1813,10 @@ gtk_image_expose (GtkWidget      *widget,
        */
       if (priv->need_calc_size)
 	gtk_image_calc_size (image);
-      
-      if (!gdk_rectangle_intersect (&area, &widget->allocation, &area))
+
+      gtk_widget_get_allocation (widget, &allocation);
+
+      if (!gdk_rectangle_intersect (&area, &allocation, &area))
 	return FALSE;
 
       gtk_misc_get_alignment (misc, &xalign, &yalign);
@@ -1819,10 +1825,9 @@ gtk_image_expose (GtkWidget      *widget,
       if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
 	xalign = 1.0 - xalign;
 
-      x = floor (widget->allocation.x + xpad
-		 + ((widget->allocation.width - widget->requisition.width) * xalign));
-      y = floor (widget->allocation.y + ypad
-		 + ((widget->allocation.height - widget->requisition.height) * yalign));
+      gtk_widget_get_requisition (widget, &requisition);
+      x = floor (allocation.x + xpad + ((allocation.width - requisition.width) * xalign));
+      y = floor (allocation.y + ypad + ((allocation.height - requisition.height) * yalign));
       mask_x = x;
       mask_y = y;
       
@@ -1898,7 +1903,7 @@ gtk_image_expose (GtkWidget      *widget,
         case GTK_IMAGE_ICON_SET:
           pixbuf =
             gtk_icon_set_render_icon (priv->data.icon_set.icon_set,
-                                      widget->style,
+                                      gtk_widget_get_style (widget),
                                       gtk_widget_get_direction (widget),
                                       gtk_widget_get_state (widget),
                                       priv->icon_size,
@@ -2007,8 +2012,8 @@ gtk_image_expose (GtkWidget      *widget,
                   gtk_icon_source_set_size (source,
                                             GTK_ICON_SIZE_SMALL_TOOLBAR);
                   gtk_icon_source_set_size_wildcarded (source, FALSE);
-                  
-                  rendered = gtk_style_render_icon (widget->style,
+
+                  rendered = gtk_style_render_icon (gtk_widget_get_style (widget),
                                                     source,
                                                     gtk_widget_get_direction (widget),
                                                     gtk_widget_get_state (widget),
@@ -2025,7 +2030,7 @@ gtk_image_expose (GtkWidget      *widget,
 
               if (pixbuf)
                 {
-                  cairo_t *cr = gdk_cairo_create (widget->window);
+                  cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
                   gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
                   gdk_cairo_rectangle (cr, &image_bound);
                   cairo_fill (cr);
@@ -2040,7 +2045,7 @@ gtk_image_expose (GtkWidget      *widget,
               switch (priv->storage_type)
                 {
                 case GTK_IMAGE_PIXMAP:
-                  cr = gdk_cairo_create (widget->window);
+                  cr = gdk_cairo_create (gtk_widget_get_window (widget));
 
                   if (mask)
                     {
@@ -2063,7 +2068,6 @@ gtk_image_expose (GtkWidget      *widget,
 
                   cairo_destroy (cr);
                   break;
-              
                 case GTK_IMAGE_PIXBUF:
                 case GTK_IMAGE_STOCK:
                 case GTK_IMAGE_ICON_SET:
@@ -2244,7 +2248,7 @@ gtk_image_calc_size (GtkImage *image)
       
     case GTK_IMAGE_ICON_SET:
       pixbuf = gtk_icon_set_render_icon (priv->data.icon_set.icon_set,
-                                         widget->style,
+                                         gtk_widget_get_style (widget),
                                          gtk_widget_get_direction (widget),
                                          gtk_widget_get_state (widget),
                                          priv->icon_size,



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