[gtk+] demos/gtk-demo/rotated_text.c: Use accessor functions to access GtkWidget



commit 3d942908d365f7e6ac2a63242fc1c62f97a58ed4
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Aug 16 00:36:34 2010 +0200

    demos/gtk-demo/rotated_text.c: Use accessor functions to access GtkWidget

 demos/gtk-demo/rotated_text.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/demos/gtk-demo/rotated_text.c b/demos/gtk-demo/rotated_text.c
index b83b2c3..4450ab0 100644
--- a/demos/gtk-demo/rotated_text.c
+++ b/demos/gtk-demo/rotated_text.c
@@ -99,6 +99,8 @@ rotated_text_expose_event (GtkWidget      *widget,
 #define N_WORDS 5
 #define FONT "Serif 18"
 
+  GtkAllocation allocation;
+
   PangoContext *context;
   PangoLayout *layout;
   PangoFontDescription *desc;
@@ -108,16 +110,20 @@ rotated_text_expose_event (GtkWidget      *widget,
 
   PangoAttrList *attrs;
 
-  int width = widget->allocation.width;
-  int height = widget->allocation.height;
+  int width;
+  int height;
   double device_radius;
   int i;
 
+  gtk_widget_get_allocation (widget, &allocation);
+  width = allocation.width;
+  height = allocation.height;
+
   /* Create a cairo context and set up a transformation matrix so that the user
    * space coordinates for the centered square where we draw are [-RADIUS, RADIUS],
    * [-RADIUS, RADIUS].
    * We first center, then change the scale. */
-  cr = gdk_cairo_create (widget->window);
+  cr = gdk_cairo_create (gtk_widget_get_window (widget));
   device_radius = MIN (width, height) / 2.;
   cairo_translate (cr,
 		   device_radius + (width - 2 * device_radius) / 2,



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