From a48d28848e8f58a8129d9224f6060b23f5d31d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Wed, 11 Aug 2010 23:10:44 +0200 Subject: [PATCH] gtk/gtkimage.c: use accessor functions to access GtkWidget --- gtk/gtkimage.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 2989b7214f..c947f021cd 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -1521,13 +1521,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; @@ -1792,6 +1794,7 @@ gtk_image_expose (GtkWidget *widget, if (gtk_widget_get_mapped (widget) && priv->storage_type != GTK_IMAGE_EMPTY) { + GtkAllocation allocation; GtkMisc *misc; GdkRectangle area, image_bound; gint x, y, mask_x, mask_y; @@ -1812,8 +1815,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); @@ -1822,10 +1827,8 @@ 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 - priv->required_width) * xalign)); - y = floor (widget->allocation.y + ypad - + ((widget->allocation.height - priv->required_height) * yalign)); + x = floor (allocation.x + xpad + ((allocation.width - priv->required_width) * xalign)); + y = floor (allocation.y + ypad + ((allocation.height - priv->required_height) * yalign)); mask_x = x; mask_y = y; @@ -1901,7 +1904,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, @@ -2010,8 +2013,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), @@ -2028,7 +2031,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); @@ -2043,7 +2046,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) { @@ -2066,7 +2069,6 @@ gtk_image_expose (GtkWidget *widget, cairo_destroy (cr); break; - case GTK_IMAGE_PIXBUF: case GTK_IMAGE_STOCK: case GTK_IMAGE_ICON_SET: @@ -2247,7 +2249,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,