[gtk+/refactor: 5/18] gtk/gtkmisc.c: use accessor functions to access GtkWidget



commit d5fd4430334d705eb307dd6711a9104873dd22d6
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Aug 11 23:07:02 2010 +0200

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

 gtk/gtkmisc.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkmisc.c b/gtk/gtkmisc.c
index 94d3052..d4f50fa 100644
--- a/gtk/gtkmisc.c
+++ b/gtk/gtkmisc.c
@@ -268,7 +268,7 @@ gtk_misc_set_padding (GtkMisc *misc,
 		      gint     ypad)
 {
   GtkMiscPrivate *priv;
-  GtkRequisition *requisition;
+  GtkRequisition requisition;
 
   g_return_if_fail (GTK_IS_MISC (misc));
 
@@ -334,6 +334,8 @@ gtk_misc_get_padding (GtkMisc *misc,
 static void
 gtk_misc_realize (GtkWidget *widget)
 {
+  GtkAllocation allocation;
+  GdkWindow *window;
   GdkWindowAttr attributes;
   gint attributes_mask;
 
@@ -341,27 +343,32 @@ gtk_misc_realize (GtkWidget *widget)
 
   if (!gtk_widget_get_has_window (widget))
     {
-      widget->window = gtk_widget_get_parent_window (widget);
-      g_object_ref (widget->window);
-      widget->style = gtk_style_attach (widget->style, widget->window);
+      window = gtk_widget_get_parent_window (widget);
+      gtk_widget_set_window (widget, window);
+      g_object_ref (window);
+
+      gtk_widget_style_attach (widget);
     }
   else
     {
+      gtk_widget_get_allocation (widget, &allocation);
+
       attributes.window_type = GDK_WINDOW_CHILD;
-      attributes.x = widget->allocation.x;
-      attributes.y = widget->allocation.y;
-      attributes.width = widget->allocation.width;
-      attributes.height = widget->allocation.height;
+      attributes.x = allocation.x;
+      attributes.y = allocation.y;
+      attributes.width = allocation.width;
+      attributes.height = allocation.height;
       attributes.wclass = GDK_INPUT_OUTPUT;
       attributes.visual = gtk_widget_get_visual (widget);
       attributes.colormap = gtk_widget_get_colormap (widget);
       attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
       attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
 
-      widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-      gdk_window_set_user_data (widget->window, widget);
+      window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+      gtk_widget_set_window (widget, window);
+      gdk_window_set_user_data (window, widget);
 
-      widget->style = gtk_style_attach (widget->style, widget->window);
-      gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+      gtk_widget_style_attach (widget);
+      gdk_window_set_back_pixmap (window, NULL, TRUE);
     }
 }



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