[gtk+/refactor: 33/106] Use accessor functions to acces GtkContainer



commit 3a10216dd01c8d10df235b88c8942b2fda15689b
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Jun 2 06:28:22 2010 +0200

    Use accessor functions to acces GtkContainer

 demos/gtk-demo/offscreen_window.c  |   14 +++---
 demos/gtk-demo/offscreen_window2.c |   15 ++++---
 gtk/gtkalignment.c                 |    8 ++--
 gtk/gtkassistant.c                 |   41 +++++++++---------
 gtk/gtkbbox.c                      |   83 +++++++++++++++++++++---------------
 gtk/gtkbox.c                       |   14 +++---
 gtk/gtkbutton.c                    |   14 +++---
 gtk/gtkcheckbutton.c               |   23 ++++++----
 gtk/gtkcheckmenuitem.c             |    5 +-
 gtk/gtkcombobox.c                  |   32 +++++++-------
 gtk/gtkeventbox.c                  |   22 ++++++----
 gtk/gtkexpander.c                  |   24 ++++++-----
 gtk/gtkfixed.c                     |   14 +++---
 gtk/gtkframe.c                     |   25 ++++++-----
 gtk/gtkhandlebox.c                 |   23 +++++++---
 gtk/gtkimagemenuitem.c             |    4 +-
 gtk/gtkmenu.c                      |   34 ++++++++------
 gtk/gtkmenubar.c                   |   18 +++++---
 gtk/gtkmenuitem.c                  |   16 ++++---
 gtk/gtknotebook.c                  |   44 +++++++++++--------
 gtk/gtkoffscreenwindow.c           |    2 +-
 gtk/gtkpaned.c                     |   36 ++++++++++------
 gtk/gtkpathbar.c                   |   12 +++--
 gtk/gtkplug.c                      |    9 ++--
 gtk/gtkradiobutton.c               |   13 +++--
 gtk/gtkscrolledwindow.c            |   37 ++++++++++------
 gtk/gtksocket.c                    |    2 +-
 gtk/gtkstatusbar.c                 |    7 ++-
 gtk/gtktable.c                     |   24 ++++++----
 gtk/gtktearoffmenuitem.c           |   20 +++++----
 gtk/gtktextview.c                  |   21 ++++++---
 gtk/gtktoolbar.c                   |   54 ++++++++++++-----------
 gtk/gtktoolitem.c                  |   12 +++--
 gtk/gtktoolitemgroup.c             |   14 ++++--
 gtk/gtktoolpalette.c               |   13 ++++--
 gtk/gtktrayicon-x11.c              |    4 +-
 gtk/gtktreeview.c                  |    4 +-
 gtk/gtkviewport.c                  |   18 +++++---
 gtk/gtkwidget.c                    |    2 +-
 gtk/gtkwindow.c                    |   34 +++++++++------
 gtk/tests/builder.c                |    4 +-
 tests/gtkoffscreenbox.c            |   14 +++---
 42 files changed, 484 insertions(+), 345 deletions(-)
---
diff --git a/demos/gtk-demo/offscreen_window.c b/demos/gtk-demo/offscreen_window.c
index 6ff212f..9a74776 100644
--- a/demos/gtk-demo/offscreen_window.c
+++ b/demos/gtk-demo/offscreen_window.c
@@ -226,12 +226,12 @@ gtk_rotated_bin_realize (GtkWidget *widget)
   GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
   GdkWindowAttr attributes;
   gint attributes_mask;
-  gint border_width;
+  guint border_width;
   GtkRequisition child_requisition;
 
   gtk_widget_set_realized (widget, TRUE);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   attributes.x = widget->allocation.x + border_width;
   attributes.y = widget->allocation.y + border_width;
@@ -378,6 +378,7 @@ gtk_rotated_bin_size_request (GtkWidget      *widget,
   GtkRequisition child_requisition;
   double s, c;
   double w, h;
+  guint border_width;
 
   child_requisition.width = 0;
   child_requisition.height = 0;
@@ -390,8 +391,9 @@ gtk_rotated_bin_size_request (GtkWidget      *widget,
   w = c * child_requisition.width + s * child_requisition.height;
   h = s * child_requisition.width + c * child_requisition.height;
 
-  requisition->width = GTK_CONTAINER (widget)->border_width * 2 + w;
-  requisition->height = GTK_CONTAINER (widget)->border_width * 2 + h;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width = border_width * 2 + w;
+  requisition->height = border_width * 2 + h;
 }
 
 static void
@@ -399,13 +401,13 @@ gtk_rotated_bin_size_allocate (GtkWidget     *widget,
                                GtkAllocation *allocation)
 {
   GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
-  gint border_width;
+  guint border_width;
   gint w, h;
   gdouble s, c;
 
   widget->allocation = *allocation;
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   w = allocation->width - border_width * 2;
   h = allocation->height - border_width * 2;
diff --git a/demos/gtk-demo/offscreen_window2.c b/demos/gtk-demo/offscreen_window2.c
index 3ee3630..1c9b084 100644
--- a/demos/gtk-demo/offscreen_window2.c
+++ b/demos/gtk-demo/offscreen_window2.c
@@ -164,12 +164,12 @@ gtk_mirror_bin_realize (GtkWidget *widget)
   GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
   GdkWindowAttr attributes;
   gint attributes_mask;
-  gint border_width;
+  guint border_width;
   GtkRequisition child_requisition;
 
   gtk_widget_set_realized (widget, TRUE);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   attributes.x = widget->allocation.x + border_width;
   attributes.y = widget->allocation.y + border_width;
@@ -302,6 +302,7 @@ gtk_mirror_bin_size_request (GtkWidget      *widget,
 {
   GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
   GtkRequisition child_requisition;
+  guint border_width;
 
   child_requisition.width = 0;
   child_requisition.height = 0;
@@ -309,8 +310,9 @@ gtk_mirror_bin_size_request (GtkWidget      *widget,
   if (bin->child && gtk_widget_get_visible (bin->child))
     gtk_widget_size_request (bin->child, &child_requisition);
 
-  requisition->width = GTK_CONTAINER (widget)->border_width * 2 + child_requisition.width + 10;
-  requisition->height = GTK_CONTAINER (widget)->border_width * 2 + child_requisition.height * 2 + 10;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width = border_width * 2 + child_requisition.width + 10;
+  requisition->height = border_width * 2 + child_requisition.height * 2 + 10;
 }
 
 static void
@@ -318,11 +320,12 @@ gtk_mirror_bin_size_allocate (GtkWidget     *widget,
                                GtkAllocation *allocation)
 {
   GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
-  gint border_width;
   gint w, h;
+  guint border_width;
+
   widget->allocation = *allocation;
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   w = allocation->width - border_width * 2;
   h = allocation->height - border_width * 2;
diff --git a/gtk/gtkalignment.c b/gtk/gtkalignment.c
index e9c6550..9f5f53e 100644
--- a/gtk/gtkalignment.c
+++ b/gtk/gtkalignment.c
@@ -478,7 +478,7 @@ gtk_alignment_size_allocate (GtkWidget     *widget,
   GtkBin *bin;
   GtkAllocation child_allocation;
   gint width, height;
-  gint border_width;
+  guint border_width;
   gint padding_horizontal, padding_vertical;
   GtkAlignmentPrivate *priv;
 
@@ -496,7 +496,7 @@ gtk_alignment_size_allocate (GtkWidget     *widget,
       gint child_nat_height;
       gint child_width, child_height;
 
-      border_width = GTK_CONTAINER (alignment)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (alignment));
 
       priv = GTK_ALIGNMENT_GET_PRIVATE (widget);
       padding_horizontal = priv->padding_left + priv->padding_right;
@@ -567,11 +567,11 @@ gtk_alignment_get_size (GtkSizeRequest *widget,
 {
   GtkWidget *child;
   GtkAlignmentPrivate *priv;
-  gint minimum, natural;
+  guint minimum, natural;
 
   priv = GTK_ALIGNMENT_GET_PRIVATE (widget);
 
-  natural = minimum = GTK_CONTAINER (widget)->border_width * 2;
+  natural = minimum = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
 
   if ((child = gtk_bin_get_child (GTK_BIN (widget))) && gtk_widget_get_visible (child))
     {
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index f4565df..3d38804 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -1140,6 +1140,7 @@ gtk_assistant_size_request (GtkWidget      *widget,
   GtkRequisition child_requisition;
   gint header_padding, content_padding;
   gint width, height, header_width, header_height;
+  guint border_width;
   GList *list;
 
   gtk_widget_style_get (widget,
@@ -1188,8 +1189,9 @@ gtk_assistant_size_request (GtkWidget      *widget,
   width   = MAX (width, child_requisition.width);
   height += child_requisition.height + ACTION_AREA_SPACING;
 
-  width += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
-  height += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  width += border_width * 2 + content_padding * 2;
+  height += border_width * 2 + content_padding * 2;
 
   requisition->width = width;
   requisition->height = height;
@@ -1205,6 +1207,7 @@ gtk_assistant_size_allocate (GtkWidget      *widget,
   GtkRequisition header_requisition, action_requisition, sidebar_requisition;
   GtkAllocation child_allocation, header_allocation;
   gint header_padding, content_padding;
+  guint border_width;
   gboolean rtl;
   GList *pages;
 
@@ -1217,13 +1220,14 @@ gtk_assistant_size_allocate (GtkWidget      *widget,
 			NULL);
 
   widget->allocation = *allocation;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   /* Header */
   gtk_widget_get_child_requisition (priv->header_image, &header_requisition);
 
-  header_allocation.x = GTK_CONTAINER (widget)->border_width + header_padding;
-  header_allocation.y = GTK_CONTAINER (widget)->border_width + header_padding;
-  header_allocation.width  = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * header_padding;
+  header_allocation.x = border_width + header_padding;
+  header_allocation.y = border_width + header_padding;
+  header_allocation.width  = allocation->width - 2 * border_width - 2 * header_padding;
   header_allocation.height = header_requisition.height;
 
   gtk_widget_size_allocate (priv->header_image, &header_allocation);
@@ -1231,10 +1235,9 @@ gtk_assistant_size_allocate (GtkWidget      *widget,
   /* Action area */
   gtk_widget_get_child_requisition (priv->action_area, &action_requisition);
 
-  child_allocation.x = GTK_CONTAINER (widget)->border_width;
-  child_allocation.y = allocation->height -
-    GTK_CONTAINER (widget)->border_width - action_requisition.height;
-  child_allocation.width  = allocation->width - 2 * GTK_CONTAINER (widget)->border_width;
+  child_allocation.x = border_width;
+  child_allocation.y = allocation->height - border_width - action_requisition.height;
+  child_allocation.width  = allocation->width - 2 * border_width;
   child_allocation.height = action_requisition.height;
 
   gtk_widget_size_allocate (priv->action_area, &child_allocation);
@@ -1243,25 +1246,23 @@ gtk_assistant_size_allocate (GtkWidget      *widget,
   gtk_widget_get_child_requisition (priv->sidebar_image, &sidebar_requisition);
 
   if (rtl)
-    child_allocation.x = allocation->width -
-      GTK_CONTAINER (widget)->border_width - sidebar_requisition.width;
+    child_allocation.x = allocation->width - border_width - sidebar_requisition.width;
   else
-    child_allocation.x = GTK_CONTAINER (widget)->border_width;
+    child_allocation.x = border_width;
 
-  child_allocation.y = GTK_CONTAINER (widget)->border_width +
-    priv->header_image->allocation.height + 2 * header_padding;
+  child_allocation.y = border_width + priv->header_image->allocation.height + 2 * header_padding;
   child_allocation.width = sidebar_requisition.width;
-  child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
+  child_allocation.height = allocation->height - 2 * border_width -
     priv->header_image->allocation.height - 2 * header_padding - priv->action_area->allocation.height;
 
   gtk_widget_size_allocate (priv->sidebar_image, &child_allocation);
 
   /* Pages */
-  child_allocation.x = GTK_CONTAINER (widget)->border_width + content_padding;
-  child_allocation.y = GTK_CONTAINER (widget)->border_width +
+  child_allocation.x = border_width + content_padding;
+  child_allocation.y = border_width +
     priv->header_image->allocation.height + 2 * header_padding + content_padding;
-  child_allocation.width  = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * content_padding;
-  child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
+  child_allocation.width  = allocation->width - 2 * border_width - 2 * content_padding;
+  child_allocation.height = allocation->height - 2 * border_width -
     priv->header_image->allocation.height - 2 * header_padding - ACTION_AREA_SPACING - priv->action_area->allocation.height - 2 * content_padding;
 
   if (gtk_widget_get_visible (priv->sidebar_image))
@@ -1452,7 +1453,7 @@ gtk_assistant_focus (GtkWidget        *widget,
   priv = GTK_ASSISTANT (widget)->priv;
 
   /* we only have to care about 2 widgets, action area and the current page */
-  if (container->focus_child == priv->action_area)
+  if (gtk_container_get_focus_child (container) == priv->action_area)
     {
       if (!gtk_widget_child_focus (priv->action_area, direction) &&
 	  (priv->current_page == NULL ||
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index 826e310..e2f37f9 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -341,14 +341,14 @@ gboolean
 gtk_button_box_get_child_secondary (GtkButtonBox *widget,
 				    GtkWidget    *child)
 {
-  GtkBoxChild *child_info;
-  GList *list;
+  GtkBoxChild *child_info = NULL;
+  GList *list, *children;
 
   g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), FALSE);
   g_return_val_if_fail (GTK_IS_WIDGET (child), FALSE);
 
-  child_info = NULL;
-  list = gtk_container_get_children (GTK_CONTAINER (widget));
+  list = children = gtk_container_get_children (GTK_CONTAINER (widget));
+
   while (list)
     {
       child_info = list->data;
@@ -358,9 +358,16 @@ gtk_button_box_get_child_secondary (GtkButtonBox *widget,
       list = list->next;
     }
 
-  g_return_val_if_fail (list != NULL, FALSE);
-
-  return child_info->is_secondary;
+  if (list == NULL)
+    {
+      g_list_free (children);
+      return FALSE;
+    }
+  else
+    {
+      g_list_free (children);
+      return child_info->is_secondary;
+    }
 }
 
 /**
@@ -388,13 +395,14 @@ gtk_button_box_set_child_secondary (GtkButtonBox *widget,
 				    GtkWidget    *child,
 				    gboolean      is_secondary)
 {
-  GList *list;
-  
+  GList *list, *children;
+
   g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
   g_return_if_fail (GTK_IS_WIDGET (child));
   g_return_if_fail (child->parent == GTK_WIDGET (widget));
 
-  list = gtk_container_get_children (GTK_CONTAINER (widget));
+
+  list = children = gtk_container_get_children (GTK_CONTAINER (widget));
   while (list)
     {
       GtkBoxChild *child_info = list->data;
@@ -406,6 +414,7 @@ gtk_button_box_set_child_secondary (GtkButtonBox *widget,
 
       list = list->next;
     }
+  g_list_free (children);
 
   gtk_widget_child_notify (child, "secondary");
 
@@ -427,7 +436,7 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
   GtkButtonBoxPriv *priv;
   GtkButtonBox *bbox;
   GtkBoxChild *child;
-  GList *children;
+  GList *children, *list;
   gint nchildren;
   gint nsecondaries;
   gint needed_width;
@@ -468,7 +477,7 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
 
   nchildren = 0;
   nsecondaries = 0;
-  children = gtk_container_get_children (GTK_CONTAINER (bbox));
+  list = children = gtk_container_get_children (GTK_CONTAINER (bbox));
   needed_width = child_min_width;
   needed_height = child_min_height;  
   ipad_w = ipad_x * 2;
@@ -493,6 +502,8 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
 	}
     }
 
+  g_list_free (list);
+
   if (nvis_children)
     *nvis_children = nchildren;
   if (nvis_secondaries)
@@ -531,6 +542,7 @@ gtk_button_box_size_request (GtkWidget      *widget,
   gint child_width;
   gint child_height;
   gint spacing;
+  guint border_width;
   GtkButtonBoxStyle layout;
   GtkOrientation orientation;
 
@@ -590,8 +602,9 @@ gtk_button_box_size_request (GtkWidget      *widget,
         requisition->width = child_width;
     }
 
-  requisition->width += GTK_CONTAINER (box)->border_width * 2;
-  requisition->height += GTK_CONTAINER (box)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 }
 
 static void
@@ -602,7 +615,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
   GtkBox *base_box;
   GtkButtonBox *box;
   GtkBoxChild *child;
-  GList *children;
+  GList *children, *list;
   GtkAllocation child_allocation;
   gint nvis_children;
   gint n_secondaries;
@@ -618,12 +631,14 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
   gint childspacing = 0;
   GtkButtonBoxStyle layout;
   gint spacing;
+  guint border_width;
   GtkOrientation orientation;
 
   base_box = GTK_BOX (widget);
   box = GTK_BUTTON_BOX (widget);
   priv = box->priv;
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
   orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
   spacing = gtk_box_get_spacing (base_box);
   layout = priv->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
@@ -636,9 +651,9 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
   widget->allocation = *allocation;
 
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
-    width = allocation->width - GTK_CONTAINER (box)->border_width*2;
+    width = allocation->width - border_width*2;
   else
-    height = allocation->height - GTK_CONTAINER (box)->border_width*2;
+    height = allocation->height - border_width*2;
 
   switch (layout)
     {
@@ -648,8 +663,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
           {
             childspacing = (width - (nvis_children * child_width))
                     / (nvis_children + 1);
-            x = allocation->x + GTK_CONTAINER (box)->border_width
-                    + childspacing;
+            x = allocation->x + border_width + childspacing;
             secondary_x = x + ((nvis_children - n_secondaries)
                             * (child_width + childspacing));
           }
@@ -657,8 +671,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
           {
             childspacing = (height - (nvis_children * child_height))
                     / (nvis_children + 1);
-            y = allocation->y + GTK_CONTAINER (box)->border_width
-                    + childspacing;
+            y = allocation->y + border_width + childspacing;
             secondary_y = y + ((nvis_children - n_secondaries)
                             * (child_height + childspacing));
           }
@@ -673,7 +686,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
               {
                 childspacing = (width - (nvis_children * child_width))
                       / (nvis_children - 1);
-                x = allocation->x + GTK_CONTAINER (box)->border_width;
+                x = allocation->x + border_width;
                 secondary_x = x + ((nvis_children - n_secondaries)
                                    * (child_width + childspacing));
               }
@@ -691,7 +704,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
               {
                 childspacing = (height - (nvis_children*child_height))
                         / (nvis_children-1);
-                y = allocation->y + GTK_CONTAINER (box)->border_width;
+                y = allocation->y + border_width;
                 secondary_y = y + ((nvis_children - n_secondaries)
                                 * (child_height + childspacing));
               }
@@ -711,20 +724,20 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
         if (orientation == GTK_ORIENTATION_HORIZONTAL)
           {
             childspacing = spacing;
-            x = allocation->x + GTK_CONTAINER (box)->border_width;
+            x = allocation->x + border_width;
             secondary_x = allocation->x + allocation->width
               - child_width * n_secondaries
               - spacing * (n_secondaries - 1)
-              - GTK_CONTAINER (box)->border_width;
+              - border_width;
           }
         else
           {
             childspacing = spacing;
-            y = allocation->y + GTK_CONTAINER (box)->border_width;
+            y = allocation->y + border_width;
             secondary_y = allocation->y + allocation->height
               - child_height * n_secondaries
               - spacing * (n_secondaries - 1)
-              - GTK_CONTAINER (box)->border_width;
+              - border_width;
           }
 
         break;
@@ -737,8 +750,8 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
             x = allocation->x + allocation->width
               - child_width * (nvis_children - n_secondaries)
               - spacing * (nvis_children - n_secondaries - 1)
-              - GTK_CONTAINER (box)->border_width;
-            secondary_x = allocation->x + GTK_CONTAINER (box)->border_width;
+              - border_width;
+            secondary_x = allocation->x + border_width;
           }
         else
           {
@@ -746,8 +759,8 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
             y = allocation->y + allocation->height
               - child_height * (nvis_children - n_secondaries)
               - spacing * (nvis_children - n_secondaries - 1)
-              - GTK_CONTAINER (box)->border_width;
-            secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
+              - border_width;
+            secondary_y = allocation->y + border_width;
           }
 
         break;
@@ -762,7 +775,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
                - (child_width * (nvis_children - n_secondaries)
                + spacing * (nvis_children - n_secondaries - 1))) / 2
               + (n_secondaries * child_width + n_secondaries * spacing) / 2;
-            secondary_x = allocation->x + GTK_CONTAINER (box)->border_width;
+            secondary_x = allocation->x + border_width;
           }
         else
           {
@@ -772,7 +785,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
                - (child_height * (nvis_children - n_secondaries)
                   + spacing * (nvis_children - n_secondaries - 1))) / 2
               + (n_secondaries * child_height + n_secondaries * spacing) / 2;
-            secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
+            secondary_y = allocation->y + border_width;
           }
 
         break;
@@ -793,7 +806,7 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
         childspace = child_height + childspacing;
       }
 
-  children = gtk_container_get_children (GTK_CONTAINER (box));
+  list = children = gtk_container_get_children (GTK_CONTAINER (box));
 
   while (children)
     {
@@ -843,6 +856,8 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
           gtk_widget_size_allocate (child->widget, &child_allocation);
         }
     }
+
+  g_list_free (list);
 }
 
 /**
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 2451b6b..899da0e 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -427,7 +427,7 @@ gtk_box_size_allocate (GtkWidget     *widget,
 
   if (nvis_children > 0)
     {
-      gint border_width = GTK_CONTAINER (box)->border_width;
+      guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
       GtkTextDirection direction = gtk_widget_get_direction (widget);
       GtkAllocation child_allocation;
       GtkBoxSpreading *spreading = g_newa (GtkBoxSpreading, nvis_children);
@@ -882,7 +882,7 @@ gtk_box_get_size (GtkSizeRequest      *widget,
 
   box = GTK_BOX (widget);
   private = box->priv;
-  border_width = GTK_CONTAINER (box)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
 
   minimum = natural = 0;
 
@@ -981,7 +981,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
   gint           nvis_children;
   gint           nexpand_children;
   gint           computed_minimum = 0, computed_natural = 0;
-  gint           border_width = GTK_CONTAINER (box)->border_width;
+  guint          border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
 
   count_expand_children (box, &nvis_children, &nexpand_children);
 
@@ -1184,8 +1184,10 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
   gint           nvis_children = 0;
   gint           required_size = 0, required_natural = 0, child_size, child_natural;
   gint           largest_child = 0, largest_natural = 0;
+  guint          border_width;
 
-  avail_size -= GTK_CONTAINER (box)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
+  avail_size -= border_width * 2;
 
   for (children = private->children; children != NULL; 
        children = children->next, nvis_children++)
@@ -1229,8 +1231,8 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
       required_natural  += (nvis_children - 1) * private->spacing;
     }
 
-  required_size    += GTK_CONTAINER (box)->border_width * 2;
-  required_natural += GTK_CONTAINER (box)->border_width * 2;
+  required_size    += border_width * 2;
+  required_natural += border_width * 2;
 
   if (minimum_size)
     *minimum_size = required_size;
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index e7d29f4..6af6f72 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1273,7 +1273,7 @@ gtk_button_realize (GtkWidget *widget)
   button = GTK_BUTTON (widget);
   gtk_widget_set_realized (widget, TRUE);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.x = widget->allocation.x + border_width;
@@ -1435,7 +1435,7 @@ gtk_button_size_allocate (GtkWidget     *widget,
   GtkButton *button = GTK_BUTTON (widget);
   GtkAllocation child_allocation;
 
-  gint border_width = GTK_CONTAINER (widget)->border_width;
+  guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   gint xthickness = GTK_WIDGET (widget)->style->xthickness;
   gint ythickness = GTK_WIDGET (widget)->style->ythickness;
   GtkBorder default_border;
@@ -1530,7 +1530,7 @@ _gtk_button_paint (GtkButton          *button,
 
   if (gtk_widget_is_drawable (widget))
     {
-      border_width = GTK_CONTAINER (widget)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
       gtk_button_get_props (button, &default_border, &default_outside_border, NULL, &interior_focus);
       gtk_widget_style_get (widget,
@@ -1883,6 +1883,7 @@ gtk_button_get_size (GtkSizeRequest *widget,
   gint focus_width;
   gint focus_pad;
   gint minimum, natural;
+  guint border_width;
 
   gtk_button_get_props (button, &default_border, NULL, &inner_border, NULL);
   gtk_widget_style_get (GTK_WIDGET (widget),
@@ -1890,18 +1891,19 @@ gtk_button_get_size (GtkSizeRequest *widget,
 			"focus-padding", &focus_pad,
 			NULL);
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
-      minimum = ((GTK_CONTAINER (widget)->border_width +
+      minimum = ((border_width +
 		  GTK_WIDGET (widget)->style->xthickness) * 2 +
 		 inner_border.left + inner_border.right);
-      
+
       if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
 	minimum += default_border.left + default_border.right;
     }
   else
     {
-      minimum = ((GTK_CONTAINER (widget)->border_width +
+      minimum = ((border_width +
 		  GTK_WIDGET (widget)->style->ythickness) * 2 +
 		 inner_border.top + inner_border.bottom);
 
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 9caa978..2f3f84f 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -146,8 +146,8 @@ gtk_check_button_paint (GtkWidget    *widget,
 			    NULL);
 
       gtk_check_button_draw_indicator (check_button, area);
-      
-      border_width = GTK_CONTAINER (widget)->border_width;
+
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
       if (gtk_widget_has_focus (widget))
 	{
 	  GtkWidget *child = GTK_BIN (widget)->child;
@@ -196,9 +196,11 @@ gtk_check_button_size_request (GtkWidget      *widget,
       gint temp;
       gint indicator_size;
       gint indicator_spacing;
-      gint border_width = GTK_CONTAINER (widget)->border_width;
       gint focus_width;
       gint focus_pad;
+      guint border_width;
+
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
       gtk_widget_style_get (GTK_WIDGET (widget),
 			    "focus-line-width", &focus_width,
@@ -266,7 +268,7 @@ gtk_check_button_size_allocate (GtkWidget     *widget,
       if (GTK_BIN (button)->child && gtk_widget_get_visible (GTK_BIN (button)->child))
 	{
 	  GtkRequisition child_requisition;
- 	  gint border_width = GTK_CONTAINER (widget)->border_width;
+          guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
 	  gtk_widget_get_child_requisition (GTK_BIN (button)->child, &child_requisition);
  
@@ -354,6 +356,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
   gint indicator_spacing;
   gint focus_width;
   gint focus_pad;
+  guint border_width;
   gboolean interior_focus;
 
   widget = GTK_WIDGET (check_button);
@@ -371,7 +374,9 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
 
       _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
 
-      x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+      x = widget->allocation.x + indicator_spacing + border_width;
       y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
 
       child = GTK_BIN (check_button)->child;
@@ -402,10 +407,10 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
 	  GdkRectangle restrict_area;
 	  GdkRectangle new_area;
 	      
-	  restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
-	  restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
-	  restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
-	  restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
+	  restrict_area.x = widget->allocation.x + border_width;
+	  restrict_area.y = widget->allocation.y + border_width;
+	  restrict_area.width = widget->allocation.width - (2 * border_width);
+	  restrict_area.height = widget->allocation.height - (2 * border_width);
 	  
 	  if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
 	    {
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index 8f140d2..32bebf7 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -469,6 +469,7 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
 
   if (gtk_widget_is_drawable (widget))
     {
+      guint border_width;
       guint offset;
       guint toggle_size;
       guint toggle_spacing;
@@ -482,8 +483,8 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
  			    NULL);
 
       toggle_size = GTK_MENU_ITEM (check_menu_item)->toggle_size;
-      offset = GTK_CONTAINER (check_menu_item)->border_width +
-	widget->style->xthickness + 2; 
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+      offset = border_width + widget->style->xthickness + 2;
 
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
 	{
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index ca9c8f1..58e80d5 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -2165,6 +2165,7 @@ gtk_combo_box_size_request (GtkWidget      *widget,
   gint focus_width, focus_pad;
   gint font_size;
   gint arrow_size;
+  guint border_width;
   GtkRequisition bin_req;
   PangoContext *context;
   PangoFontMetrics *metrics;
@@ -2204,10 +2205,10 @@ gtk_combo_box_size_request (GtkWidget      *widget,
       if (priv->cell_view)
         {
           GtkRequisition button_req, sep_req, arrow_req;
-          gint border_width, xthickness, ythickness;
+          gint xthickness, ythickness;
 
           gtk_widget_size_request (priv->button, &button_req);
-	  border_width = GTK_CONTAINER (combo_box)->border_width;
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box));
           xthickness = priv->button->style->xthickness;
           ythickness = priv->button->style->ythickness;
 
@@ -2253,12 +2254,10 @@ gtk_combo_box_size_request (GtkWidget      *widget,
 	  gtk_widget_size_request (priv->cell_view_frame, &frame_req);
 	  if (priv->has_frame)
 	    {
-	      requisition->width += 2 *
-		(GTK_CONTAINER (priv->cell_view_frame)->border_width +
-		 GTK_WIDGET (priv->cell_view_frame)->style->xthickness);
-	      requisition->height += 2 *
-		(GTK_CONTAINER (priv->cell_view_frame)->border_width +
-		 GTK_WIDGET (priv->cell_view_frame)->style->ythickness);
+              border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame));
+
+	      requisition->width += 2 * (border_width + GTK_WIDGET (priv->cell_view_frame)->style->xthickness);
+	      requisition->height += 2 * (border_width + GTK_WIDGET (priv->cell_view_frame)->style->ythickness);
 	    }
         }
 
@@ -2326,8 +2325,9 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
     {
       if (priv->cell_view)
         {
-          gint border_width, xthickness, ythickness;
+          gint xthickness, ythickness;
           gint width;
+          guint border_width;
 
           /* menu mode */
           allocation->x += shadow_width;
@@ -2338,7 +2338,7 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
           gtk_widget_size_allocate (priv->button, allocation);
 
           /* set some things ready */
-          border_width = GTK_CONTAINER (priv->button)->border_width;
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->button));
           xthickness = priv->button->style->xthickness;
           ythickness = priv->button->style->ythickness;
 
@@ -2430,8 +2430,9 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
       /* list mode */
 
       /* Combobox thickness + border-width */
-      int delta_x = shadow_width + GTK_CONTAINER (widget)->border_width;
-      int delta_y = shadow_height + GTK_CONTAINER (widget)->border_width;
+      guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+      int delta_x = shadow_width + border_width;
+      int delta_y = shadow_height + border_width;
 
       /* button */
       GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
@@ -2457,10 +2458,9 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
           /* the sample */
           if (priv->has_frame)
             {
-              delta_x = GTK_CONTAINER (priv->cell_view_frame)->border_width +
-                GTK_WIDGET (priv->cell_view_frame)->style->xthickness;
-              delta_y = GTK_CONTAINER (priv->cell_view_frame)->border_width +
-                GTK_WIDGET (priv->cell_view_frame)->style->ythickness;
+              border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame));
+              delta_x = border_width + GTK_WIDGET (priv->cell_view_frame)->style->xthickness;
+              delta_y = border_width + GTK_WIDGET (priv->cell_view_frame)->style->ythickness;
 
               child.x += delta_x;
               child.y += delta_y;
diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c
index abad161..17045ff 100644
--- a/gtk/gtkeventbox.c
+++ b/gtk/gtkeventbox.c
@@ -374,7 +374,7 @@ gtk_event_box_realize (GtkWidget *widget)
 
   gtk_widget_set_realized (widget, TRUE);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   
   attributes.x = widget->allocation.x + border_width;
   attributes.y = widget->allocation.y + border_width;
@@ -483,9 +483,11 @@ gtk_event_box_size_request (GtkWidget      *widget,
 			    GtkRequisition *requisition)
 {
   GtkBin *bin = GTK_BIN (widget);
+  guint border_width;
 
-  requisition->width = GTK_CONTAINER (widget)->border_width * 2;
-  requisition->height = GTK_CONTAINER (widget)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width = border_width * 2;
+  requisition->height = border_width * 2;
 
   if (bin->child && gtk_widget_get_visible (bin->child))
     {
@@ -505,22 +507,24 @@ gtk_event_box_size_allocate (GtkWidget     *widget,
   GtkBin *bin;
   GtkAllocation child_allocation;
   GtkEventBoxPrivate *priv;
+  guint border_width;
   
   widget->allocation = *allocation;
   bin = GTK_BIN (widget);
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   
   if (!gtk_widget_get_has_window (widget))
     {
-      child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width;
-      child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width;
+      child_allocation.x = allocation->x + border_width;
+      child_allocation.y = allocation->y + border_width;
     }
   else
     {
       child_allocation.x = 0;
       child_allocation.y = 0;
     }
-  child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0);
-  child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0);
+  child_allocation.width = MAX (allocation->width - border_width * 2, 0);
+  child_allocation.height = MAX (allocation->height - border_width * 2, 0);
 
   if (gtk_widget_get_realized (widget))
     {
@@ -535,8 +539,8 @@ gtk_event_box_size_allocate (GtkWidget     *widget,
       
       if (gtk_widget_get_has_window (widget))
 	gdk_window_move_resize (widget->window,
-				allocation->x + GTK_CONTAINER (widget)->border_width,
-				allocation->y + GTK_CONTAINER (widget)->border_width,
+				allocation->x + border_width,
+				allocation->y + border_width,
 				child_allocation.width,
 				child_allocation.height);
     }
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 2707696..8610f0b 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -404,7 +404,7 @@ gtk_expander_realize (GtkWidget *widget)
   priv = GTK_EXPANDER (widget)->priv;
   gtk_widget_set_realized (widget, TRUE);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   get_expander_bounds (GTK_EXPANDER (widget), &expander_rect);
   
@@ -475,7 +475,7 @@ gtk_expander_size_request (GtkWidget      *widget,
   expander = GTK_EXPANDER (widget);
   priv = expander->priv;
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   gtk_widget_style_get (widget,
 			"interior-focus", &interior_focus,
@@ -535,7 +535,7 @@ get_expander_bounds (GtkExpander  *expander,
   widget = GTK_WIDGET (expander);
   priv = expander->priv;
 
-  border_width = GTK_CONTAINER (expander)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   gtk_widget_style_get (widget,
 			"interior-focus", &interior_focus,
@@ -593,7 +593,7 @@ gtk_expander_size_allocate (GtkWidget     *widget,
   GtkExpanderPrivate *priv;
   GtkRequisition child_requisition;
   gboolean child_visible = FALSE;
-  gint border_width;
+  guint border_width;
   gint expander_size;
   gint expander_spacing;
   gboolean interior_focus;
@@ -605,7 +605,7 @@ gtk_expander_size_allocate (GtkWidget     *widget,
   bin = GTK_BIN (widget);
   priv = expander->priv;
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   gtk_widget_style_get (widget,
 			"interior-focus", &interior_focus,
@@ -747,6 +747,7 @@ gtk_expander_paint_prelight (GtkExpander *expander)
   int focus_pad;
   int expander_size;
   int expander_spacing;
+  guint border_width;
 
   priv = expander->priv;
   widget = GTK_WIDGET (expander);
@@ -760,9 +761,10 @@ gtk_expander_paint_prelight (GtkExpander *expander)
 			"expander-spacing", &expander_spacing,
 			NULL);
 
-  area.x = widget->allocation.x + container->border_width;
-  area.y = widget->allocation.y + container->border_width;
-  area.width = widget->allocation.width - (2 * container->border_width);
+  border_width = gtk_container_get_border_width (container);
+  area.x = widget->allocation.x + border_width;
+  area.y = widget->allocation.y + border_width;
+  area.width = widget->allocation.width - (2 * border_width);
 
   if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
     area.height = priv->label_widget->allocation.height;
@@ -830,7 +832,7 @@ gtk_expander_paint_focus (GtkExpander  *expander,
   widget = GTK_WIDGET (expander);
   priv = expander->priv;
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   gtk_widget_style_get (widget,
 			"interior-focus", &interior_focus,
@@ -1080,7 +1082,7 @@ focus_current_site (GtkExpander      *expander,
 {
   GtkWidget *current_focus;
 
-  current_focus = GTK_CONTAINER (expander)->focus_child;
+  current_focus = gtk_container_get_focus_child (GTK_CONTAINER (expander));
 
   if (!current_focus)
     return FALSE;
@@ -1204,7 +1206,7 @@ gtk_expander_focus (GtkWidget        *widget,
       FocusSite site = FOCUS_NONE;
       
       widget_is_focus = gtk_widget_is_focus (widget);
-      old_focus_child = GTK_CONTAINER (widget)->focus_child;
+      old_focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget));
       
       if (old_focus_child && old_focus_child == expander->priv->label_widget)
 	site = FOCUS_LABEL;
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 820d71c..587636a 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -310,6 +310,7 @@ gtk_fixed_size_request (GtkWidget      *widget,
   GtkFixedChild *child;
   GList *children;
   GtkRequisition child_requisition;
+  guint border_width;
 
   fixed = GTK_FIXED (widget);
   requisition->width = 0;
@@ -334,8 +335,9 @@ gtk_fixed_size_request (GtkWidget      *widget,
 	}
     }
 
-  requisition->height += GTK_CONTAINER (fixed)->border_width * 2;
-  requisition->width += GTK_CONTAINER (fixed)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (fixed));
+  requisition->height += border_width * 2;
+  requisition->width += border_width * 2;
 }
 
 static void
@@ -347,7 +349,7 @@ gtk_fixed_size_allocate (GtkWidget     *widget,
   GtkAllocation child_allocation;
   GtkRequisition child_requisition;
   GList *children;
-  guint16 border_width;
+  guint border_width;
 
   fixed = GTK_FIXED (widget);
 
@@ -362,9 +364,9 @@ gtk_fixed_size_allocate (GtkWidget     *widget,
 				allocation->width, 
 				allocation->height);
     }
-      
-  border_width = GTK_CONTAINER (fixed)->border_width;
-  
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (fixed));
+
   children = fixed->children;
   while (children)
     {
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 01707fc..cb8ddd2 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -681,6 +681,7 @@ gtk_frame_real_compute_child_allocation (GtkFrame      *frame,
   GtkAllocation *allocation = &widget->allocation;
   GtkRequisition child_requisition;
   gint top_margin;
+  guint border_width;
 
   if (frame->label_widget)
     {
@@ -689,14 +690,15 @@ gtk_frame_real_compute_child_allocation (GtkFrame      *frame,
     }
   else
     top_margin = widget->style->ythickness;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (frame));
   
-  child_allocation->x = (GTK_CONTAINER (frame)->border_width +
-			 widget->style->xthickness);
+  child_allocation->x = border_width + widget->style->xthickness;
   child_allocation->width = MAX(1, (gint)allocation->width - child_allocation->x * 2);
   
-  child_allocation->y = (GTK_CONTAINER (frame)->border_width + top_margin);
+  child_allocation->y = border_width + top_margin;
   child_allocation->height = MAX (1, ((gint)allocation->height - child_allocation->y -
-				      (gint)GTK_CONTAINER (frame)->border_width -
+				      border_width -
 				      (gint)widget->style->ythickness));
   
   child_allocation->x += allocation->x;
@@ -714,6 +716,7 @@ gtk_frame_get_size (GtkSizeRequest *request,
   GtkBin *bin = GTK_BIN (widget);
   gint child_min, child_nat;
   gint minimum, natural;
+  guint border_width;
 
   if (frame->label_widget && gtk_widget_get_visible (frame->label_widget))
     {
@@ -756,19 +759,17 @@ gtk_frame_get_size (GtkSizeRequest *request,
         }
     }
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
-      minimum += (GTK_CONTAINER (widget)->border_width +
-                  GTK_WIDGET (widget)->style->xthickness) * 2;
-      natural += (GTK_CONTAINER (widget)->border_width +
-                  GTK_WIDGET (widget)->style->xthickness) * 2;
+      minimum += (border_width + GTK_WIDGET (widget)->style->xthickness) * 2;
+      natural += (border_width + GTK_WIDGET (widget)->style->xthickness) * 2;
     }
   else
     {
-      minimum += (GTK_CONTAINER (widget)->border_width +
-                  GTK_WIDGET (widget)->style->ythickness) * 2;
-      natural += (GTK_CONTAINER (widget)->border_width +
-                  GTK_WIDGET (widget)->style->ythickness) * 2;
+      minimum += (border_width + GTK_WIDGET (widget)->style->ythickness) * 2;
+      natural += (border_width + GTK_WIDGET (widget)->style->ythickness) * 2;
     }
 
  if (minimum_size)
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index 5576019..b51b062 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -573,8 +573,11 @@ gtk_handle_box_size_request (GtkWidget      *widget,
     }
   else
     {
-      requisition->width += GTK_CONTAINER (widget)->border_width * 2;
-      requisition->height += GTK_CONTAINER (widget)->border_width * 2;
+      guint border_width;
+
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+      requisition->width += border_width * 2;
+      requisition->height += border_width * 2;
       
       if (bin->child)
 	{
@@ -626,7 +629,7 @@ gtk_handle_box_size_allocate (GtkWidget     *widget,
       GtkAllocation child_allocation;
       guint border_width;
 
-      border_width = GTK_CONTAINER (widget)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
       child_allocation.x = border_width;
       child_allocation.y = border_width;
@@ -1045,6 +1048,10 @@ gtk_handle_box_button_press (GtkWidget      *widget,
 
       if (child)
 	{
+          guint border_width;
+
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (hb));
+
 	  switch (handle_position)
 	    {
 	    case GTK_POS_LEFT:
@@ -1054,10 +1061,10 @@ gtk_handle_box_button_press (GtkWidget      *widget,
 	      in_handle = event->y < DRAG_HANDLE_SIZE;
 	      break;
 	    case GTK_POS_RIGHT:
-	      in_handle = event->x > 2 * GTK_CONTAINER (hb)->border_width + child->allocation.width;
+	      in_handle = event->x > 2 * border_width + child->allocation.width;
 	      break;
 	    case GTK_POS_BOTTOM:
-	      in_handle = event->y > 2 * GTK_CONTAINER (hb)->border_width + child->allocation.height;
+	      in_handle = event->y > 2 * border_width + child->allocation.height;
 	      break;
 	    default:
 	      in_handle = FALSE;
@@ -1312,6 +1319,7 @@ gtk_handle_box_motion (GtkWidget      *widget,
 	{
 	  gint width;
 	  gint height;
+          guint border_width;
 	  GtkRequisition child_requisition;
 
 	  hb->child_detached = TRUE;
@@ -1324,8 +1332,9 @@ gtk_handle_box_motion (GtkWidget      *widget,
 	      child_requisition.height = 0;
 	    }      
 
-	  width = child_requisition.width + 2 * GTK_CONTAINER (hb)->border_width;
-	  height = child_requisition.height + 2 * GTK_CONTAINER (hb)->border_width;
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (hb));
+	  width = child_requisition.width + 2 * border_width;
+	  height = child_requisition.height + 2 * border_width;
 
 	  if (handle_position == GTK_POS_LEFT || handle_position == GTK_POS_RIGHT)
 	    width += DRAG_HANDLE_SIZE;
diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c
index 605c63e..7a50a01 100644
--- a/gtk/gtkimagemenuitem.c
+++ b/gtk/gtkimagemenuitem.c
@@ -486,7 +486,7 @@ gtk_image_menu_item_size_allocate (GtkWidget     *widget,
       if (pack_dir == GTK_PACK_DIRECTION_LTR ||
 	  pack_dir == GTK_PACK_DIRECTION_RTL)
 	{
-	  offset = GTK_CONTAINER (image_menu_item)->border_width +
+	  offset = gtk_container_get_border_width (GTK_CONTAINER (image_menu_item)) +
 	    widget->style->xthickness;
 	  
 	  if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) ==
@@ -504,7 +504,7 @@ gtk_image_menu_item_size_allocate (GtkWidget     *widget,
 	}
       else
 	{
-	  offset = GTK_CONTAINER (image_menu_item)->border_width +
+	  offset = gtk_container_get_border_width (GTK_CONTAINER (image_menu_item)) +
 	    widget->style->ythickness;
 	  
 	  if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) ==
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index f119c6f..55497e3 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2403,7 +2403,7 @@ gtk_menu_realize (GtkWidget *widget)
   widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
   gdk_window_set_user_data (widget->window, widget);
   
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   gtk_widget_style_get (GTK_WIDGET (menu),
 			"vertical-padding", &vertical_padding,
@@ -2540,6 +2540,7 @@ gtk_menu_size_request (GtkWidget      *widget,
   guint max_accel_width;
   guint vertical_padding;
   guint horizontal_padding;
+  guint border_width;
   GtkRequisition child_requisition;
   GtkMenuPrivate *priv;
   
@@ -2628,10 +2629,9 @@ gtk_menu_size_request (GtkWidget      *widget,
                         "horizontal-padding", &horizontal_padding,
 			NULL);
 
-  requisition->width += (GTK_CONTAINER (menu)->border_width + horizontal_padding +
-			 widget->style->xthickness) * 2;
-  requisition->height += (GTK_CONTAINER (menu)->border_width + vertical_padding +
-			  widget->style->ythickness) * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
+  requisition->width += (border_width + horizontal_padding + widget->style->xthickness) * 2;
+  requisition->height += (border_width + vertical_padding + widget->style->ythickness) * 2;
   
   menu->toggle_size = max_toggle_size;
 
@@ -2654,6 +2654,7 @@ gtk_menu_size_allocate (GtkWidget     *widget,
   GList *children;
   gint x, y;
   gint width, height;
+  guint border_width;
   guint vertical_padding;
   guint horizontal_padding;
   
@@ -2672,8 +2673,9 @@ gtk_menu_size_allocate (GtkWidget     *widget,
                         "horizontal-padding", &horizontal_padding,
 			NULL);
 
-  x = GTK_CONTAINER (menu)->border_width + widget->style->xthickness + horizontal_padding;
-  y = GTK_CONTAINER (menu)->border_width + widget->style->ythickness + vertical_padding;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
+  x = border_width + widget->style->xthickness + horizontal_padding;
+  y = border_width + widget->style->ythickness + vertical_padding;
 
   width = MAX (1, allocation->width - x * 2);
   height = MAX (1, allocation->height - y * 2);
@@ -2814,6 +2816,7 @@ get_arrows_visible_area (GtkMenu      *menu,
                          gint         *arrow_space)
 {
   GtkWidget *widget = GTK_WIDGET (menu);
+  guint border_width;
   guint vertical_padding;
   guint horizontal_padding;
   gint scroll_arrow_height;
@@ -2826,8 +2829,9 @@ get_arrows_visible_area (GtkMenu      *menu,
                         "arrow-placement", &arrow_placement,
                         NULL);
 
-  border->x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness + horizontal_padding;
-  border->y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness + vertical_padding;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  border->x = border_width + widget->style->xthickness + horizontal_padding;
+  border->y = border_width + widget->style->ythickness + vertical_padding;
   gdk_drawable_get_size (widget->window, &border->width, &border->height);
 
   switch (arrow_placement)
@@ -3626,7 +3630,7 @@ get_arrows_sensitive_area (GtkMenu      *menu,
                            GdkRectangle *lower)
 {
   gint width, height;
-  gint border;
+  guint border;
   guint vertical_padding;
   gint win_x, win_y;
   gint scroll_arrow_height;
@@ -3640,7 +3644,7 @@ get_arrows_sensitive_area (GtkMenu      *menu,
                         "arrow-placement", &arrow_placement,
                         NULL);
 
-  border = GTK_CONTAINER (menu)->border_width +
+  border = gtk_container_get_border_width (GTK_CONTAINER (menu)) +
     GTK_WIDGET (menu)->style->ythickness + vertical_padding;
 
   gdk_window_get_position (GTK_WIDGET (menu)->window, &win_x, &win_y);
@@ -4585,7 +4589,7 @@ gtk_menu_scroll_to (GtkMenu *menu,
 
   double_arrows = get_double_arrows (menu);
 
-  border_width = GTK_CONTAINER (menu)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
   view_width -= (border_width + widget->style->xthickness + horizontal_padding) * 2;
   view_height -= (border_width + widget->style->ythickness + vertical_padding) * 2;
   menu_height = widget->requisition.height -
@@ -4795,7 +4799,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
 
       double_arrows = get_double_arrows (menu);
 
-      height -= 2*GTK_CONTAINER (menu)->border_width + 2*GTK_WIDGET (menu)->style->ythickness + 2*vertical_padding;
+      height -= 2*gtk_container_get_border_width (GTK_CONTAINER (menu)) + 2*GTK_WIDGET (menu)->style->ythickness + 2*vertical_padding;
       
       if (child_offset < y)
 	{
@@ -5178,7 +5182,7 @@ get_visible_size (GtkMenu *menu)
   GtkContainer *container = GTK_CONTAINER (menu);
   
   gint menu_height = (widget->allocation.height
-		      - 2 * (container->border_width
+		      - 2 * (gtk_container_get_border_width (container)
 			     + widget->style->ythickness));
 
   if (!menu->tearoff_active)
@@ -5244,7 +5248,7 @@ get_menu_height (GtkMenu *menu)
   GtkWidget *widget = GTK_WIDGET (menu);
 
   height = widget->requisition.height;
-  height -= (GTK_CONTAINER (widget)->border_width + widget->style->ythickness) * 2;
+  height -= gtk_container_get_border_width (GTK_CONTAINER (widget) + widget->style->ythickness) * 2;
 
   if (!menu->tearoff_active)
     {
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 9f898b5..a06304e 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -282,6 +282,7 @@ gtk_menu_bar_size_request (GtkWidget      *widget,
   gint nchildren;
   GtkRequisition child_requisition;
   gint ipadding;
+  guint border_width;
 
   g_return_if_fail (GTK_IS_MENU_BAR (widget));
   g_return_if_fail (requisition != NULL);
@@ -334,11 +335,12 @@ gtk_menu_bar_size_request (GtkWidget      *widget,
 	}
 
       gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
-      
-      requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
+
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
+      requisition->width += (border_width +
                              ipadding + 
 			     BORDER_SPACING) * 2;
-      requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
+      requisition->height += (border_width +
                               ipadding +
 			      BORDER_SPACING) * 2;
 
@@ -365,6 +367,7 @@ gtk_menu_bar_size_allocate (GtkWidget     *widget,
   GtkTextDirection direction;
   gint ltr_x, ltr_y;
   gint ipadding;
+  guint border_width;
 
   g_return_if_fail (GTK_IS_MENU_BAR (widget));
   g_return_if_fail (allocation != NULL);
@@ -385,10 +388,11 @@ gtk_menu_bar_size_allocate (GtkWidget     *widget,
   
   if (menu_shell->children)
     {
-      child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
+      child_allocation.x = (border_width +
 			    ipadding + 
 			    BORDER_SPACING);
-      child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
+      child_allocation.y = (border_width +
 			    BORDER_SPACING);
       
       if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
@@ -509,9 +513,9 @@ gtk_menu_bar_paint (GtkWidget    *widget,
 
   if (gtk_widget_is_drawable (widget))
     {
-      gint border;
+      guint border;
 
-      border = GTK_CONTAINER (widget)->border_width;
+      border = gtk_container_get_border_width (GTK_CONTAINER (widget));
       
       gtk_paint_box (widget->style,
 		     widget->window,
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 8e85ced..316c9c3 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -936,6 +936,7 @@ gtk_menu_item_size_request (GtkWidget      *widget,
   GtkBin *bin;
   guint accel_width;
   guint horizontal_padding;
+  guint border_width;
   GtkPackDirection pack_dir;
   GtkPackDirection child_pack_dir;
 
@@ -960,10 +961,9 @@ gtk_menu_item_size_request (GtkWidget      *widget,
       child_pack_dir = GTK_PACK_DIRECTION_LTR;
     }
 
-  requisition->width = (GTK_CONTAINER (widget)->border_width +
-			widget->style->xthickness) * 2;
-  requisition->height = (GTK_CONTAINER (widget)->border_width +
-			 widget->style->ythickness) * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width = (border_width + widget->style->xthickness) * 2;
+  requisition->height = (border_width + widget->style->ythickness) * 2;
 
   if ((pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) &&
       (child_pack_dir == GTK_PACK_DIRECTION_LTR || child_pack_dir == GTK_PACK_DIRECTION_RTL))
@@ -1054,13 +1054,15 @@ gtk_menu_item_size_allocate (GtkWidget     *widget,
     {
       GtkRequisition child_requisition;
       guint horizontal_padding;
+      guint border_width;
 
       gtk_widget_style_get (widget,
 			    "horizontal-padding", &horizontal_padding,
 			    NULL);
 
-      child_allocation.x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness;
-      child_allocation.y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+      child_allocation.x = border_width + widget->style->xthickness;
+      child_allocation.y = border_width + widget->style->ythickness;
 
       if ((pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) &&
 	  (child_pack_dir == GTK_PACK_DIRECTION_LTR || child_pack_dir == GTK_PACK_DIRECTION_RTL))
@@ -1185,7 +1187,7 @@ gtk_menu_item_paint (GtkWidget    *widget,
   GtkShadowType shadow_type, selected_shadow_type;
   gint width, height;
   gint x, y;
-  gint border_width = GTK_CONTAINER (widget)->border_width;
+  guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   if (gtk_widget_is_drawable (widget))
     {
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 10a1be2..c6bb222 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -1313,7 +1313,7 @@ gtk_notebook_move_focus_out (GtkNotebook      *notebook,
   GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type);
   GtkWidget *toplevel;
   
-  if (GTK_CONTAINER (notebook)->focus_child && effective_direction == GTK_DIR_UP)
+  if (gtk_container_get_focus_child (GTK_CONTAINER (notebook)) && effective_direction == GTK_DIR_UP)
     if (focus_tabs_in (notebook))
       return;
   if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && effective_direction == GTK_DIR_DOWN)
@@ -1604,7 +1604,7 @@ gtk_notebook_get_event_window_position (GtkNotebook  *notebook,
 {
   GtkNotebookPriv *priv = notebook->priv;
   GtkWidget *widget = GTK_WIDGET (notebook);
-  gint border_width = GTK_CONTAINER (notebook)->border_width;
+  guint border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
   GtkNotebookPage *visible_page = NULL;
   GList *tmp_list;
   gint tab_pos = get_effective_tab_pos (notebook);
@@ -1822,6 +1822,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
   gint arrow_spacing;
   gint scroll_arrow_hlength;
   gint scroll_arrow_vlength;
+  guint border_width;
 
   gtk_widget_style_get (widget,
                         "focus-line-width", &focus_width,
@@ -2059,8 +2060,10 @@ gtk_notebook_size_request (GtkWidget      *widget,
 	}
     }
 
-  widget->requisition.width += GTK_CONTAINER (widget)->border_width * 2;
-  widget->requisition.height += GTK_CONTAINER (widget)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+  widget->requisition.width += border_width * 2;
+  widget->requisition.height += border_width * 2;
 
   if (switch_page)
     {
@@ -2079,8 +2082,8 @@ gtk_notebook_size_request (GtkWidget      *widget,
 	}
       else if (gtk_widget_get_visible (widget))
 	{
-	  widget->requisition.width = GTK_CONTAINER (widget)->border_width * 2;
-	  widget->requisition.height= GTK_CONTAINER (widget)->border_width * 2;
+	  widget->requisition.width = border_width * 2;
+	  widget->requisition.height= border_width * 2;
 	}
     }
   if (vis_pages && !priv->cur_page)
@@ -2125,7 +2128,7 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
 
   if (priv->children)
     {
-      gint border_width = GTK_CONTAINER (widget)->border_width;
+      guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
       GtkNotebookPage *page;
       GtkAllocation child_allocation;
       GList *children;
@@ -3991,7 +3994,7 @@ gtk_notebook_focus (GtkWidget        *widget,
     }
 
   widget_is_focus = gtk_widget_is_focus (widget);
-  old_focus_child = container->focus_child;
+  old_focus_child = gtk_container_get_focus_child (container);
 
   effective_direction = get_effective_direction (notebook, direction);
 
@@ -4395,7 +4398,7 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
   gint tab_pos = get_effective_tab_pos (notebook);
 
   widget = GTK_WIDGET (notebook);
-  border = GTK_CONTAINER (notebook)->border_width;
+  border = gtk_container_get_border_width (GTK_CONTAINER (notebook));
 
   if (!gtk_widget_get_mapped (widget) || !priv->first_tab)
     return;
@@ -4802,7 +4805,7 @@ gtk_notebook_paint (GtkWidget    *widget,
   gboolean showarrow;
   gint width, height;
   gint x, y;
-  gint border_width = GTK_CONTAINER (widget)->border_width;
+  guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   gint gap_x = 0, gap_width = 0, step = STEP_PREV;
   gboolean is_rtl;
   gint tab_pos;
@@ -5072,6 +5075,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
   gint scroll_arrow_vlength;
   gboolean is_rtl;
   gint i;
+  guint border_width;
 
   widget = GTK_WIDGET (notebook);
   children = priv->children;
@@ -5083,12 +5087,14 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
                         "scroll-arrow-vlength", &scroll_arrow_vlength,
                         NULL);
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
+
   switch (tab_pos)
     {
     case GTK_POS_TOP:
     case GTK_POS_BOTTOM:
-      *min = widget->allocation.x + GTK_CONTAINER (notebook)->border_width;
-      *max = widget->allocation.x + widget->allocation.width - GTK_CONTAINER (notebook)->border_width;
+      *min = widget->allocation.x + border_width;
+      *max = widget->allocation.x + widget->allocation.width - border_width;
 
       for (i = 0; i < N_ACTION_WIDGETS; i++)
         {
@@ -5116,8 +5122,8 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
       break;
     case GTK_POS_RIGHT:
     case GTK_POS_LEFT:
-      *min = widget->allocation.y + GTK_CONTAINER (notebook)->border_width;
-      *max = widget->allocation.y + widget->allocation.height - GTK_CONTAINER (notebook)->border_width;
+      *min = widget->allocation.y + border_width;
+      *max = widget->allocation.y + widget->allocation.height - border_width;
 
       for (i = 0; i < N_ACTION_WIDGETS; i++)
         {
@@ -5459,6 +5465,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
   gint tab_overlap, tab_pos, tab_extra_space;
   gint left_x, right_x, top_y, bottom_y, anchor;
   gint xthickness, ythickness;
+  guint border_width;
   gboolean gap_left, packing_changed;
   GtkAllocation child_allocation = { 0, };
 
@@ -5469,8 +5476,9 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
   allocate_at_bottom = get_allocate_at_bottom (widget, direction);
   anchor = 0;
 
-  child_allocation.x = widget->allocation.x + container->border_width;
-  child_allocation.y = widget->allocation.y + container->border_width;
+  border_width = gtk_container_get_border_width (container);
+  child_allocation.x = widget->allocation.x + border_width;
+  child_allocation.y = widget->allocation.y + border_width;
 
   xthickness = widget->style->xthickness;
   ythickness = widget->style->ythickness;
@@ -5479,7 +5487,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
     {
     case GTK_POS_BOTTOM:
       child_allocation.y = widget->allocation.y + widget->allocation.height -
-	priv->cur_page->requisition.height - container->border_width;
+	priv->cur_page->requisition.height - border_width;
       /* fall through */
     case GTK_POS_TOP:
       child_allocation.x = (allocate_at_bottom) ? max : min;
@@ -5489,7 +5497,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
       
     case GTK_POS_RIGHT:
       child_allocation.x = widget->allocation.x + widget->allocation.width -
-	priv->cur_page->requisition.width - container->border_width;
+	priv->cur_page->requisition.width - border_width;
       /* fall through */
     case GTK_POS_LEFT:
       child_allocation.y = (allocate_at_bottom) ? max : min;
diff --git a/gtk/gtkoffscreenwindow.c b/gtk/gtkoffscreenwindow.c
index c62e2eb..7e05fcb 100644
--- a/gtk/gtkoffscreenwindow.c
+++ b/gtk/gtkoffscreenwindow.c
@@ -171,7 +171,7 @@ move_focus (GtkWidget       *widget,
 {
   gtk_widget_child_focus (widget, dir);
 
-  if (!GTK_CONTAINER (widget)->focus_child)
+  if (!gtk_container_get_focus_child (GTK_CONTAINER (widget)))
     gtk_window_set_focus (GTK_WINDOW (widget), NULL);
 }
 
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index f1103fb..e6c4e40 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -760,6 +760,7 @@ gtk_paned_size_request (GtkWidget      *widget,
 {
   GtkPaned *paned = GTK_PANED (widget);
   GtkRequisition child_requisition;
+  guint border_width;
 
   requisition->width = 0;
   requisition->height = 0;
@@ -790,8 +791,9 @@ gtk_paned_size_request (GtkWidget      *widget,
         }
     }
 
-  requisition->width += GTK_CONTAINER (paned)->border_width * 2;
-  requisition->height += GTK_CONTAINER (paned)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (paned));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 
   if (paned->child1 && gtk_widget_get_visible (paned->child1) &&
       paned->child2 && gtk_widget_get_visible (paned->child2))
@@ -822,7 +824,9 @@ gtk_paned_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
   GtkPaned *paned = GTK_PANED (widget);
-  gint border_width = GTK_CONTAINER (paned)->border_width;
+  guint border_width;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (paned));
 
   widget->allocation = *allocation;
 
@@ -1137,7 +1141,7 @@ update_drag (GtkPaned *paned)
       size = pos;
     }
 
-  size -= GTK_CONTAINER (paned)->border_width;
+  size -= gtk_container_get_border_width (GTK_CONTAINER (paned));
   
   size = CLAMP (size, paned->min_position, paned->max_position);
 
@@ -1718,6 +1722,7 @@ gtk_paned_set_focus_child (GtkContainer *container,
 			   GtkWidget    *focus_child)
 {
   GtkPaned *paned;
+  GtkWidget *container_focus_child;
   
   g_return_if_fail (GTK_IS_PANED (container));
 
@@ -1738,10 +1743,11 @@ gtk_paned_set_focus_child (GtkContainer *container,
 	  for (w = last_focus; w != GTK_WIDGET (paned); w = w->parent)
 	    if (GTK_IS_PANED (w))
 	      last_focus = w;
-	  
-	  if (container->focus_child == paned->child1)
+
+          container_focus_child = gtk_container_get_focus_child (container);
+          if (container_focus_child == paned->child1)
 	    gtk_paned_set_last_child1_focus (paned, last_focus);
-	  else if (container->focus_child == paned->child2)
+	  else if (container_focus_child == paned->child2)
 	    gtk_paned_set_last_child2_focus (paned, last_focus);
 	}
     }
@@ -1757,6 +1763,7 @@ gtk_paned_get_cycle_chain (GtkPaned          *paned,
 {
   GtkContainer *container = GTK_CONTAINER (paned);
   GtkWidget *ancestor = NULL;
+  GtkWidget *focus_child;
   GList *temp_list = NULL;
   GList *list;
 
@@ -1788,15 +1795,16 @@ gtk_paned_get_cycle_chain (GtkPaned          *paned,
    * paned->last_child?_focus before paned->child?, both when we
    * are going forward and backward.
    */
+  focus_child = gtk_container_get_focus_child (container);
   if (direction == GTK_DIR_TAB_FORWARD)
     {
-      if (container->focus_child == paned->child1)
+      if (focus_child == paned->child1)
 	{
 	  temp_list = g_list_append (temp_list, paned->last_child2_focus);
 	  temp_list = g_list_append (temp_list, paned->child2);
 	  temp_list = g_list_append (temp_list, ancestor);
 	}
-      else if (container->focus_child == paned->child2)
+      else if (focus_child == paned->child2)
 	{
 	  temp_list = g_list_append (temp_list, ancestor);
 	  temp_list = g_list_append (temp_list, paned->last_child1_focus);
@@ -1813,13 +1821,13 @@ gtk_paned_get_cycle_chain (GtkPaned          *paned,
     }
   else
     {
-      if (container->focus_child == paned->child1)
+      if (focus_child == paned->child1)
 	{
 	  temp_list = g_list_append (temp_list, ancestor);
 	  temp_list = g_list_append (temp_list, paned->last_child2_focus);
 	  temp_list = g_list_append (temp_list, paned->child2);
 	}
-      else if (container->focus_child == paned->child2)
+      else if (focus_child == paned->child2)
 	{
 	  temp_list = g_list_append (temp_list, paned->last_child1_focus);
 	  temp_list = g_list_append (temp_list, paned->child1);
@@ -2158,10 +2166,12 @@ gtk_paned_cycle_handle_focus (GtkPaned *paned,
       GtkPaned *first;
       GtkPaned *prev, *next;
       GtkWidget *toplevel;
+      GtkWidget *focus_child;
 
       gtk_paned_find_neighbours (paned, &next, &prev);
+      focus_child = gtk_container_get_focus_child (container);
 
-      if (container->focus_child == paned->child1)
+      if (focus_child == paned->child1)
 	{
 	  if (reversed)
 	    {
@@ -2174,7 +2184,7 @@ gtk_paned_cycle_handle_focus (GtkPaned *paned,
 	      first = paned;
 	    }
 	}
-      else if (container->focus_child == paned->child2)
+      else if (focus_child == paned->child2)
 	{
 	  if (reversed)
 	    {
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 08236dd..3c36f38 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -320,6 +320,7 @@ gtk_path_bar_size_request (GtkWidget      *widget,
   GtkPathBar *path_bar;
   GtkRequisition child_requisition;
   GList *list;
+  guint border_width;
 
   path_bar = GTK_PATH_BAR (widget);
 
@@ -351,8 +352,9 @@ gtk_path_bar_size_request (GtkWidget      *widget,
   gtk_widget_size_request (path_bar->up_slider_button, &child_requisition);
   gtk_widget_size_request (path_bar->down_slider_button, &child_requisition);
 
-  requisition->width += GTK_CONTAINER (widget)->border_width * 2;
-  requisition->height += GTK_CONTAINER (widget)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 
   widget->requisition = *requisition;
 }
@@ -458,7 +460,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   GList *list, *first_button;
   gint width;
   gint allocation_width;
-  gint border_width;
+  guint border_width;
   gboolean need_sliders = FALSE;
   gint up_slider_offset = 0;
   GtkRequisition child_requisition;
@@ -475,7 +477,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
     return;
 
   direction = gtk_widget_get_direction (widget);
-  border_width = (gint) GTK_CONTAINER (path_bar)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (path_bar));
   allocation_width = allocation->width - 2 * border_width;
 
   /* First, we check to see if we need the scrollbars. */
@@ -831,7 +833,7 @@ gtk_path_bar_scroll_down (GtkPathBar *path_bar)
     }
 
   space_available = (GTK_WIDGET (path_bar)->allocation.width
-		     - 2 * GTK_CONTAINER (path_bar)->border_width
+		     - 2 * gtk_container_get_border_width (GTK_CONTAINER (path_bar))
 		     - 2 * path_bar->spacing - 2 * path_bar->slider_width
 		     - BUTTON_DATA (down_button->data)->button->allocation.width);
   path_bar->first_scrolled_button = down_button;
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index 3a30ab5..722fe87 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -765,7 +765,7 @@ gtk_plug_size_allocate (GtkWidget     *widget,
 	{
 	  GtkAllocation child_allocation;
 	  
-	  child_allocation.x = child_allocation.y = GTK_CONTAINER (widget)->border_width;
+	  child_allocation.x = child_allocation.y = gtk_container_get_border_width (GTK_CONTAINER (widget));
 	  child_allocation.width =
 	    MAX (1, (gint)allocation->width - child_allocation.x * 2);
 	  child_allocation.height =
@@ -947,9 +947,10 @@ gtk_plug_focus (GtkWidget        *widget,
   GtkPlug *plug = GTK_PLUG (widget);
   GtkWindow *window = GTK_WINDOW (widget);
   GtkContainer *container = GTK_CONTAINER (widget);
-  GtkWidget *old_focus_child = container->focus_child;
+  GtkWidget *old_focus_child;
   GtkWidget *parent;
-  
+
+  old_focus_child = gtk_container_get_focus_child (container);
   /* We override GtkWindow's behavior, since we don't want wrapping here.
    */
   if (old_focus_child)
@@ -977,7 +978,7 @@ gtk_plug_focus (GtkWidget        *widget,
         return TRUE;
     }
 
-  if (!GTK_CONTAINER (window)->focus_child)
+  if (!gtk_container_get_focus_child (GTK_CONTAINER (window)))
     _gtk_plug_windowing_focus_to_parent (plug, direction);
 
   return FALSE;
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 4343779..4824456 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -807,6 +807,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
   gint indicator_size, indicator_spacing;
   gint focus_width;
   gint focus_pad;
+  guint border_width;
   gboolean interior_focus;
 
   widget = GTK_WIDGET (check_button);
@@ -816,6 +817,8 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
       button = GTK_BUTTON (check_button);
       toggle_button = GTK_TOGGLE_BUTTON (check_button);
 
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
       gtk_widget_style_get (widget,
 			    "interior-focus", &interior_focus,
 			    "focus-line-width", &focus_width,
@@ -824,7 +827,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
 
       _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
 
-      x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
+      x = widget->allocation.x + indicator_spacing + border_width;
       y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
 
       child = GTK_BIN (check_button)->child;
@@ -855,10 +858,10 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
 	  GdkRectangle restrict_area;
 	  GdkRectangle new_area;
 	      
-	  restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
-	  restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
-	  restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
-	  restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
+	  restrict_area.x = widget->allocation.x + border_width;
+	  restrict_area.y = widget->allocation.y + border_width;
+	  restrict_area.width = widget->allocation.width - (2 * border_width);
+	  restrict_area.height = widget->allocation.height - (2 * border_width);
 	  
 	  if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
 	    {
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 674eb85..9accb0d 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1058,11 +1058,14 @@ gtk_scrolled_window_paint (GtkWidget    *widget,
       else
         {
           GtkContainer *container = GTK_CONTAINER (widget);
+          guint border_width;
 
-          relative_allocation.x = container->border_width;
-          relative_allocation.y = container->border_width;
-          relative_allocation.width = widget->allocation.width - 2 * container->border_width;
-          relative_allocation.height = widget->allocation.height - 2 * container->border_width;
+          border_width = gtk_container_get_border_width (container);
+
+          relative_allocation.x = border_width;
+          relative_allocation.y = border_width;
+          relative_allocation.width = widget->allocation.width - 2 * border_width;
+          relative_allocation.height = widget->allocation.height - 2 * border_width;
         }
 
       gtk_paint_shadow (widget->style, widget->window,
@@ -1249,6 +1252,7 @@ gtk_scrolled_window_relative_allocation (GtkWidget     *widget,
   GtkScrolledWindow *scrolled_window;
   GtkScrolledWindowPrivate *priv;
   gint scrollbar_spacing;
+  guint border_width;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (allocation != NULL);
@@ -1258,8 +1262,9 @@ gtk_scrolled_window_relative_allocation (GtkWidget     *widget,
 
   priv = GTK_SCROLLED_WINDOW_GET_PRIVATE (scrolled_window);
 
-  allocation->x = GTK_CONTAINER (widget)->border_width;
-  allocation->y = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  allocation->x = border_width;
+  allocation->y = border_width;
 
   if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
     {
@@ -1314,6 +1319,7 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
   GtkAllocation child_allocation;
   gboolean scrollbars_within_bevel;
   gint scrollbar_spacing;
+  guint border_width;
   
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
   g_return_if_fail (allocation != NULL);
@@ -1326,6 +1332,7 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
 
   priv = GTK_SCROLLED_WINDOW_GET_PRIVATE (scrolled_window);
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (scrolled_window));
   widget->allocation = *allocation;
 
   if (scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
@@ -1403,7 +1410,7 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
 			      (scrolled_window->shadow_type == GTK_SHADOW_NONE ?
 			       0 : widget->style->ythickness));
       else
-	child_allocation.y = GTK_CONTAINER (scrolled_window)->border_width;
+	child_allocation.y = border_width;
 
       child_allocation.width = relative_allocation.width;
       child_allocation.height = hscrollbar_requisition.height;
@@ -1454,7 +1461,7 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
 			      (scrolled_window->shadow_type == GTK_SHADOW_NONE ?
 			       0 : widget->style->xthickness));
       else
-	child_allocation.x = GTK_CONTAINER (scrolled_window)->border_width;
+	child_allocation.x = border_width;
 
       child_allocation.y = relative_allocation.y;
       child_allocation.width = vscrollbar_requisition.width;
@@ -1520,7 +1527,9 @@ gtk_scrolled_window_focus (GtkWidget        *widget,
 			   GtkDirectionType  direction)
 {
   GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
-  gboolean had_focus_child = GTK_CONTAINER (widget)->focus_child != NULL;
+  gboolean had_focus_child;
+
+  had_focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget)) != NULL;
   
   if (scrolled_window->focus_out)
     {
@@ -1739,6 +1748,7 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget,
   GtkRequisition vscrollbar_requisition;
   GtkRequisition minimum_req, natural_req;
   gint min_child_size, nat_child_size;
+  guint border_width;
 
   scrolled_window = GTK_SCROLLED_WINDOW (widget);
   bin = GTK_BIN (scrolled_window);
@@ -1835,10 +1845,11 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget,
 	extra_width = scrollbar_spacing + vscrollbar_requisition.width;
     }
 
-  minimum_req.width += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_width);
-  minimum_req.height += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_height);
-  natural_req.width += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_width);
-  natural_req.height += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_height);
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  minimum_req.width += border_width * 2 + MAX (0, extra_width);
+  minimum_req.height += border_width * 2 + MAX (0, extra_height);
+  natural_req.width += border_width * 2 + MAX (0, extra_width);
+  natural_req.height += border_width * 2 + MAX (0, extra_height);
 
   if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
     {
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index 9d679d1..bb7d514 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -1009,7 +1009,7 @@ _gtk_socket_advance_toplevel_focus (GtkSocket        *socket,
   /* This is a copy of gtk_window_focus(), modified so that we
    * can detect wrap-around.
    */
-  old_focus_child = container->focus_child;
+  old_focus_child = gtk_container_get_focus_child (container);
   
   if (old_focus_child)
     {
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c
index 0ee091d..9ef8727 100644
--- a/gtk/gtkstatusbar.c
+++ b/gtk/gtkstatusbar.c
@@ -977,7 +977,7 @@ gtk_statusbar_size_request (GtkWidget      *widget,
 static gboolean
 has_extra_children (GtkStatusbar *statusbar)
 {
-  GList *l;
+  GList *l, *children;
   GtkBoxChild *child, *frame;
 
   /* If the internal frame has been modified assume we have extra children */
@@ -985,7 +985,8 @@ has_extra_children (GtkStatusbar *statusbar)
     return TRUE;
 
   frame = NULL;
-  for (l = gtk_container_get_children (GTK_CONTAINER (statusbar)); l; l = l->next)
+  children = gtk_container_get_children (GTK_CONTAINER (statusbar));
+  for (l = children; l; l = l->next)
     {
       frame = l->data;
 
@@ -1004,6 +1005,8 @@ has_extra_children (GtkStatusbar *statusbar)
 	return TRUE;
     }
 
+  g_list_free (children);
+
   return FALSE;
 }
 
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index e7eafef..3405225 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -839,6 +839,7 @@ gtk_table_size_request (GtkWidget      *widget,
 {
   GtkTable *table = GTK_TABLE (widget);
   gint row, col;
+  guint border_width;
 
   requisition->width = 0;
   requisition->height = 0;
@@ -858,9 +859,10 @@ gtk_table_size_request (GtkWidget      *widget,
     requisition->height += table->rows[row].requisition;
   for (row = 0; row + 1 < table->nrows; row++)
     requisition->height += table->rows[row].spacing;
-  
-  requisition->width += GTK_CONTAINER (table)->border_width * 2;
-  requisition->height += GTK_CONTAINER (table)->border_width * 2;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (table));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 }
 
 static void
@@ -1361,14 +1363,15 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
   gint nexpand;
   gint nshrink;
   gint extra;
-  
+  guint border_width;
+
   /* If we were allocated more space than we requested
    *  then we have to expand any expandable rows and columns
    *  to fill in the extra space.
    */
-  
-  real_width = GTK_WIDGET (table)->allocation.width - GTK_CONTAINER (table)->border_width * 2;
-  real_height = GTK_WIDGET (table)->allocation.height - GTK_CONTAINER (table)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (table));
+  real_width = GTK_WIDGET (table)->allocation.width - border_width * 2;
+  real_height = GTK_WIDGET (table)->allocation.height - border_width * 2;
   
   if (table->homogeneous)
     {
@@ -1576,10 +1579,13 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
       if (gtk_widget_get_visible (child->widget))
 	{
 	  GtkRequisition child_requisition;
+          guint border_width;
+
 	  gtk_widget_get_child_requisition (child->widget, &child_requisition);
 
-	  x = GTK_WIDGET (table)->allocation.x + GTK_CONTAINER (table)->border_width;
-	  y = GTK_WIDGET (table)->allocation.y + GTK_CONTAINER (table)->border_width;
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (table));
+	  x = GTK_WIDGET (table)->allocation.x + border_width;
+	  y = GTK_WIDGET (table)->allocation.y + border_width;
 	  max_width = 0;
 	  max_height = 0;
 	  
diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c
index c64058e..a2a346c 100644
--- a/gtk/gtktearoffmenuitem.c
+++ b/gtk/gtktearoffmenuitem.c
@@ -76,11 +76,11 @@ static void
 gtk_tearoff_menu_item_size_request (GtkWidget      *widget,
 				    GtkRequisition *requisition)
 {
-  requisition->width = (GTK_CONTAINER (widget)->border_width +
-			widget->style->xthickness +
-			BORDER_SPACING) * 2;
-  requisition->height = (GTK_CONTAINER (widget)->border_width +
-			 widget->style->ythickness) * 2;
+  guint border_width;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width = (border_width + widget->style->xthickness + BORDER_SPACING) * 2;
+  requisition->height = (border_width + widget->style->ythickness) * 2;
 
   if (GTK_IS_MENU (widget->parent) && GTK_MENU (widget->parent)->torn_off)
     {
@@ -101,6 +101,7 @@ gtk_tearoff_menu_item_paint (GtkWidget   *widget,
   gint width, height;
   gint x, y;
   gint right_max;
+  guint border_width;
   GtkArrowType arrow_type;
   GtkTextDirection direction;
   
@@ -110,10 +111,11 @@ gtk_tearoff_menu_item_paint (GtkWidget   *widget,
 
       direction = gtk_widget_get_direction (widget);
 
-      x = widget->allocation.x + GTK_CONTAINER (menu_item)->border_width;
-      y = widget->allocation.y + GTK_CONTAINER (menu_item)->border_width;
-      width = widget->allocation.width - GTK_CONTAINER (menu_item)->border_width * 2;
-      height = widget->allocation.height - GTK_CONTAINER (menu_item)->border_width * 2;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_item));
+      x = widget->allocation.x + border_width;
+      y = widget->allocation.y + border_width;
+      width = widget->allocation.width - border_width * 2;
+      height = widget->allocation.height - border_width * 2;
       right_max = x + width;
 
       if (widget->state == GTK_STATE_PRELIGHT)
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 5af3bb6..e471b65 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -3268,6 +3268,7 @@ gtk_text_view_size_request (GtkWidget      *widget,
   GSList *tmp_list;
   gint focus_edge_width;
   gint focus_width;
+  guint border_width;
   gboolean interior_focus;
 
   text_view = GTK_TEXT_VIEW (widget);
@@ -3309,8 +3310,9 @@ gtk_text_view_size_request (GtkWidget      *widget,
   if (priv->bottom_window)
     requisition->height += priv->bottom_window->requisition.height;
 
-  requisition->width += GTK_CONTAINER (text_view)->border_width * 2;
-  requisition->height += GTK_CONTAINER (text_view)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (text_view));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
   
   tmp_list = priv->children;
   while (tmp_list != NULL)
@@ -3496,6 +3498,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   GdkRectangle bottom_rect;
   gint focus_edge_width;
   gint focus_width;
+  guint border_width;
   gboolean interior_focus;
   gboolean size_changed;
   
@@ -3507,7 +3510,9 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   size_changed =
     widget->allocation.width != allocation->width ||
     widget->allocation.height != allocation->height;
-  
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (text_view));
+
   widget->allocation = *allocation;
 
   if (gtk_widget_get_realized (widget))
@@ -3531,7 +3536,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   else
     focus_edge_width = focus_width;
   
-  width = allocation->width - focus_edge_width * 2 - GTK_CONTAINER (text_view)->border_width * 2;
+  width = allocation->width - focus_edge_width * 2 - border_width * 2;
 
   if (priv->left_window)
     left_rect.width = priv->left_window->requisition.width;
@@ -3553,7 +3558,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   bottom_rect.width = text_rect.width;
 
 
-  height = allocation->height - focus_edge_width * 2 - GTK_CONTAINER (text_view)->border_width * 2;
+  height = allocation->height - focus_edge_width * 2 - border_width * 2;
 
   if (priv->top_window)
     top_rect.height = priv->top_window->requisition.height;
@@ -3575,8 +3580,8 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   right_rect.height = text_rect.height;
 
   /* Origins */
-  left_rect.x = focus_edge_width + GTK_CONTAINER (text_view)->border_width;
-  top_rect.y = focus_edge_width + GTK_CONTAINER (text_view)->border_width;
+  left_rect.x = focus_edge_width + border_width;
+  top_rect.y = focus_edge_width + border_width;
 
   text_rect.x = left_rect.x + left_rect.width;
   text_rect.y = top_rect.y + top_rect.height;
@@ -4912,7 +4917,7 @@ gtk_text_view_focus (GtkWidget        *widget,
   container = GTK_CONTAINER (widget);  
 
   if (!gtk_widget_is_focus (widget) &&
-      container->focus_child == NULL)
+      gtk_container_get_focus_child (container) == NULL)
     {
       gtk_widget_grab_focus (widget);
       return TRUE;
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 7e2c232..a010ef9 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -743,15 +743,15 @@ gtk_toolbar_realize (GtkWidget *widget)
 {
   GtkToolbar *toolbar = GTK_TOOLBAR (widget);
   GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
-  
+
   GdkWindowAttr attributes;
   gint attributes_mask;
-  gint border_width;
-  
+  guint border_width;
+
   gtk_widget_set_realized (widget, TRUE);
-  
-  border_width = GTK_CONTAINER (widget)->border_width;
-  
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
   attributes.wclass = GDK_INPUT_ONLY;
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.x = widget->allocation.x + border_width;
@@ -798,10 +798,10 @@ gtk_toolbar_expose (GtkWidget      *widget,
   GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
   
   GList *list;
-  gint border_width;
-  
-  border_width = GTK_CONTAINER (widget)->border_width;
-  
+  guint border_width;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
   if (gtk_widget_is_drawable (widget))
     {
       gtk_paint_box (widget->style,
@@ -844,6 +844,7 @@ gtk_toolbar_size_request (GtkWidget      *widget,
   gint long_req;
   gint pack_front_size;
   gint ipadding;
+  guint border_width;
   GtkRequisition arrow_requisition;
   
   max_homogeneous_child_width = 0;
@@ -938,9 +939,10 @@ gtk_toolbar_size_request (GtkWidget      *widget,
   
   /* Extra spacing */
   ipadding = get_internal_padding (toolbar);
-  
-  requisition->width += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
-  requisition->height += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (toolbar));
+  requisition->width += 2 * (ipadding + border_width);
+  requisition->height += 2 * (ipadding + border_width);
   
   if (get_shadow_type (toolbar) != GTK_SHADOW_NONE)
     {
@@ -1171,7 +1173,7 @@ gtk_toolbar_begin_sliding (GtkToolbar *toolbar)
   
   rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
   vertical = (toolbar->orientation == GTK_ORIENTATION_VERTICAL);
-  border_width = get_internal_padding (toolbar) + GTK_CONTAINER (toolbar)->border_width;
+  border_width = get_internal_padding (toolbar) + gtk_container_get_border_width (GTK_CONTAINER (toolbar));
   
   if (rtl)
     {
@@ -1402,9 +1404,9 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
     gtk_toolbar_stop_sliding (toolbar);
   
   widget->allocation = *allocation;
-  
-  border_width = GTK_CONTAINER (toolbar)->border_width;
-  
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (toolbar));
+
   if (gtk_widget_get_realized (widget))
     {
       gdk_window_move_resize (priv->event_window,
@@ -1838,8 +1840,8 @@ gtk_toolbar_focus_home_or_end (GtkToolbar *toolbar,
   for (list = children; list != NULL; list = list->next)
     {
       GtkWidget *child = list->data;
-      
-      if (GTK_CONTAINER (toolbar)->focus_child == child)
+
+      if (gtk_container_get_focus_child (GTK_CONTAINER (toolbar)) == child)
 	break;
       
       if (gtk_widget_get_mapped (child) && gtk_widget_child_focus (child, dir))
@@ -1860,15 +1862,15 @@ gtk_toolbar_move_focus (GtkWidget        *widget,
 {
   GtkToolbar *toolbar = GTK_TOOLBAR (widget);
   GtkContainer *container = GTK_CONTAINER (toolbar);
+  GtkWidget *focus_child;
   GList *list;
   gboolean try_focus = FALSE;
   GList *children;
 
-  if (container->focus_child &&
-      gtk_widget_child_focus (container->focus_child, dir))
-    {
-      return;
-    }
+  focus_child = gtk_container_get_focus_child (container);
+
+  if (focus_child && gtk_widget_child_focus (focus_child, dir))
+    return;
   
   children = gtk_toolbar_list_children_in_focus_order (toolbar, dir);
   
@@ -1879,7 +1881,7 @@ gtk_toolbar_move_focus (GtkWidget        *widget,
       if (try_focus && gtk_widget_get_mapped (child) && gtk_widget_child_focus (child, dir))
 	break;
       
-      if (child == GTK_CONTAINER (toolbar)->focus_child)
+      if (child == focus_child)
 	try_focus = TRUE;
     }
   
@@ -1902,7 +1904,7 @@ gtk_toolbar_focus (GtkWidget        *widget,
    * arrow keys or Ctrl TAB (both of which are handled by the
    * gtk_toolbar_move_focus() keybinding function.
    */
-  if (GTK_CONTAINER (widget)->focus_child)
+  if (gtk_container_get_focus_child (GTK_CONTAINER (widget)))
     return FALSE;
 
   children = gtk_toolbar_list_children_in_focus_order (toolbar, dir);
diff --git a/gtk/gtktoolitem.c b/gtk/gtktoolitem.c
index 38911a0..a7008df 100644
--- a/gtk/gtktoolitem.c
+++ b/gtk/gtktoolitem.c
@@ -404,7 +404,7 @@ create_drag_window (GtkToolItem *toolitem)
   g_return_if_fail (toolitem->priv->use_drag_window == TRUE);
 
   widget = GTK_WIDGET (toolitem);
-  border_width = GTK_CONTAINER (toolitem)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.x = widget->allocation.x + border_width;
@@ -489,6 +489,7 @@ gtk_tool_item_size_request (GtkWidget      *widget,
 			    GtkRequisition *requisition)
 {
   GtkWidget *child = GTK_BIN (widget)->child;
+  guint border_width;
 
   if (child && gtk_widget_get_visible (child))
     {
@@ -499,9 +500,10 @@ gtk_tool_item_size_request (GtkWidget      *widget,
       requisition->height = 0;
       requisition->width = 0;
     }
-  
-  requisition->width += (GTK_CONTAINER (widget)->border_width) * 2;
-  requisition->height += (GTK_CONTAINER (widget)->border_width) * 2;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 }
 
 static void
@@ -514,7 +516,7 @@ gtk_tool_item_size_allocate (GtkWidget     *widget,
   GtkWidget *child = GTK_BIN (widget)->child;
 
   widget->allocation = *allocation;
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   if (toolitem->priv->drag_window)
     gdk_window_move_resize (toolitem->priv->drag_window,
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index 4e12a22..a6b9721 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -541,12 +541,12 @@ static void
 gtk_tool_item_group_size_request (GtkWidget      *widget,
                                   GtkRequisition *requisition)
 {
-  const gint border_width = GTK_CONTAINER (widget)->border_width;
   GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
   GtkToolItemGroupPrivate* priv = group->priv;
   GtkOrientation orientation;
   GtkRequisition item_size;
   gint requested_rows;
+  guint border_width;
 
   if (priv->children && gtk_tool_item_group_get_label_widget (group))
     {
@@ -568,6 +568,7 @@ gtk_tool_item_group_size_request (GtkWidget      *widget,
   else
     requisition->height = MAX (requisition->height, item_size.height * requested_rows);
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   requisition->width += border_width * 2;
   requisition->height += border_width * 2;
 }
@@ -607,7 +608,6 @@ gtk_tool_item_group_real_size_query (GtkWidget      *widget,
                                      GtkAllocation  *allocation,
                                      GtkRequisition *inquery)
 {
-  const gint border_width = GTK_CONTAINER (widget)->border_width;
   GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
   GtkToolItemGroupPrivate* priv = group->priv;
 
@@ -618,7 +618,9 @@ gtk_tool_item_group_real_size_query (GtkWidget      *widget,
   GtkToolbarStyle style;
 
   gint min_rows;
+  guint border_width;
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
   style = gtk_tool_shell_get_style (GTK_TOOL_SHELL (group));
 
@@ -843,7 +845,6 @@ static void
 gtk_tool_item_group_real_size_allocate (GtkWidget     *widget,
                                         GtkAllocation *allocation)
 {
-  const gint border_width = GTK_CONTAINER (widget)->border_width;
   GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
   GtkToolItemGroupPrivate* priv = group->priv;
   GtkRequisition child_requisition;
@@ -859,6 +860,9 @@ gtk_tool_item_group_real_size_allocate (GtkWidget     *widget,
 
   gint n_columns, n_rows = 1;
   gint min_rows;
+  guint border_width;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   GtkTextDirection direction = gtk_widget_get_direction (widget);
 
@@ -1159,10 +1163,12 @@ static void
 gtk_tool_item_group_realize (GtkWidget *widget)
 {
   GtkWidget *toplevel_window;
-  const gint border_width = GTK_CONTAINER (widget)->border_width;
   gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
   GdkWindowAttr attributes;
   GdkDisplay *display;
+  guint border_width;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.x = widget->allocation.x + border_width;
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 529fd95..76f4db9 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -348,11 +348,13 @@ static void
 gtk_tool_palette_size_request (GtkWidget      *widget,
                                GtkRequisition *requisition)
 {
-  const gint border_width = GTK_CONTAINER (widget)->border_width;
   GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
   GtkRequisition child_requisition;
+  guint border_width;
   guint i;
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
   requisition->width = 0;
   requisition->height = 0;
 
@@ -385,7 +387,6 @@ static void
 gtk_tool_palette_size_allocate (GtkWidget     *widget,
                                 GtkAllocation *allocation)
 {
-  const gint border_width = GTK_CONTAINER (widget)->border_width;
   GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
   GtkAdjustment *adjustment = NULL;
   GtkAllocation child_allocation;
@@ -397,6 +398,7 @@ gtk_tool_palette_size_allocate (GtkWidget     *widget,
   gint page_start, page_size = 0;
   gint offset = 0;
   guint i;
+  guint border_width;
 
   gint min_offset = -1, max_offset = -1;
 
@@ -404,6 +406,7 @@ gtk_tool_palette_size_allocate (GtkWidget     *widget,
 
   gint *group_sizes = g_newa (gint, palette->priv->groups->len);
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   GtkTextDirection direction = gtk_widget_get_direction (widget);
 
   GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->size_allocate (widget, allocation);
@@ -649,9 +652,11 @@ gtk_tool_palette_expose_event (GtkWidget      *widget,
 static void
 gtk_tool_palette_realize (GtkWidget *widget)
 {
-  const gint border_width = GTK_CONTAINER (widget)->border_width;
-  gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
   GdkWindowAttr attributes;
+  gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+  guint border_width;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.x = widget->allocation.x + border_width;
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index f4db5c4..7013e44 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -335,10 +335,10 @@ gtk_tray_icon_expose (GtkWidget      *widget,
   if (GTK_WIDGET_CLASS (gtk_tray_icon_parent_class)->expose_event)
     retval = GTK_WIDGET_CLASS (gtk_tray_icon_parent_class)->expose_event (widget, event);
 
-  focus_child = GTK_CONTAINER (widget)->focus_child;
+  focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget));
   if (focus_child && gtk_widget_has_focus (focus_child))
     {
-      border_width = GTK_CONTAINER (widget)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
       x = widget->allocation.x + border_width;
       y = widget->allocation.y + border_width;
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 8329753..3caa95d 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -7784,7 +7784,7 @@ gtk_tree_view_header_focus (GtkTreeView      *tree_view,
   if (! GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
     return FALSE;
 
-  focus_child = GTK_CONTAINER (tree_view)->focus_child;
+  focus_child = gtk_container_get_focus_child (GTK_CONTAINER (tree_view));
 
   first_column = tree_view->priv->columns;
   while (first_column)
@@ -7976,7 +7976,7 @@ gtk_tree_view_focus (GtkWidget        *widget,
   if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_can_focus (widget))
     return FALSE;
 
-  focus_child = container->focus_child;
+  focus_child = gtk_container_get_focus_child (container);
 
   gtk_tree_view_stop_editing (GTK_TREE_VIEW (widget), FALSE);
   /* Case 1.  Headers currently have focus. */
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index c3eeeb0..2ff45a9 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -352,8 +352,10 @@ viewport_get_view_allocation (GtkViewport   *viewport,
 {
   GtkWidget *widget = GTK_WIDGET (viewport);
   GtkAllocation *allocation = &widget->allocation;
-  gint border_width = GTK_CONTAINER (viewport)->border_width;
-  
+  guint border_width;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (viewport));
+
   view_allocation->x = 0;
   view_allocation->y = 0;
 
@@ -630,13 +632,15 @@ gtk_viewport_realize (GtkWidget *widget)
   GtkBin *bin = GTK_BIN (widget);
   GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
   GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
-  gint border_width = GTK_CONTAINER (widget)->border_width;
-  
+  guint border_width;
+
   GtkAllocation view_allocation;
   GdkWindowAttr attributes;
   gint attributes_mask;
   gint event_mask;
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
   gtk_widget_set_realized (widget, TRUE);
 
   attributes.x = widget->allocation.x + border_width;
@@ -776,12 +780,14 @@ gtk_viewport_size_allocate (GtkWidget     *widget,
 {
   GtkViewport *viewport = GTK_VIEWPORT (widget);
   GtkBin *bin = GTK_BIN (widget);
-  gint border_width = GTK_CONTAINER (widget)->border_width;
+  guint border_width;
   gboolean hadjustment_value_changed, vadjustment_value_changed;
   GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
   GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
   GtkAllocation child_allocation;
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
   /* If our size changed, and we have a shadow, queue a redraw on widget->window to
    * redraw the shadow correctly.
    */
@@ -896,7 +902,7 @@ gtk_viewport_get_size (GtkSizeRequest *widget,
   /* XXX This should probably be (border_width * 2); but GTK+ has
    * been doing this with a single border for a while now...
    */
-  minimum = GTK_CONTAINER (widget)->border_width;
+  minimum = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   if (GTK_VIEWPORT (widget)->shadow_type != GTK_SHADOW_NONE)
     {
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a4141af..9852350 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3075,7 +3075,7 @@ gtk_widget_unparent (GtkWidget *widget)
   if (gtk_widget_is_toplevel (toplevel))
     _gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget);
 
-  if (GTK_CONTAINER (widget->parent)->focus_child == widget)
+  if (gtk_container_get_focus_child (GTK_CONTAINER (widget->parent)) == widget)
     gtk_container_set_focus_child (GTK_CONTAINER (widget->parent), NULL);
 
   /* If we are unanchoring the child, we save around the toplevel
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 3d286ab..1ef066c 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4463,7 +4463,7 @@ gtk_window_show (GtkWidget *widget)
   gboolean need_resize;
 
   GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
-  
+
   need_resize = container->need_resize || !gtk_widget_get_realized (widget);
   container->need_resize = FALSE;
 
@@ -4929,14 +4929,16 @@ gtk_window_size_allocate (GtkWidget     *widget,
 {
   GtkWindow *window;
   GtkAllocation child_allocation;
+  guint border_width;
 
   window = GTK_WINDOW (widget);
   widget->allocation = *allocation;
 
   if (window->bin.child && gtk_widget_get_visible (window->bin.child))
     {
-      child_allocation.x = GTK_CONTAINER (window)->border_width;
-      child_allocation.y = GTK_CONTAINER (window)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
+      child_allocation.x = border_width;
+      child_allocation.y = border_width;
       child_allocation.width =
 	MAX (1, (gint)allocation->width - child_allocation.x * 2);
       child_allocation.height =
@@ -5222,7 +5224,7 @@ gtk_window_move_focus (GtkWindow       *window,
 {
   gtk_widget_child_focus (GTK_WIDGET (window), dir);
   
-  if (!GTK_CONTAINER (window)->focus_child)
+  if (!gtk_container_get_focus_child (GTK_CONTAINER (window)))
     gtk_window_set_focus (window, NULL);
 }
 
@@ -5401,7 +5403,7 @@ gtk_window_focus (GtkWidget        *widget,
   window = GTK_WINDOW (widget);
   bin = GTK_BIN (widget);
 
-  old_focus_child = container->focus_child;
+  old_focus_child = gtk_container_get_focus_child (container);
   
   /* We need a special implementation here to deal properly with wrapping
    * around in the tab chain without the danger of going into an
@@ -5556,12 +5558,14 @@ gtk_window_get_width (GtkSizeRequest      *widget,
 {
   GtkWindow *window;
   GtkWidget *child;
+  guint border_width;
 
   window = GTK_WINDOW (widget);
   child  = gtk_bin_get_child (GTK_BIN (window));
-  
-  *minimum_size = GTK_CONTAINER (window)->border_width * 2;
-  *natural_size = GTK_CONTAINER (window)->border_width * 2;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
+  *minimum_size = border_width * 2;
+  *natural_size = border_width * 2;
 
   if (child && gtk_widget_get_visible (child))
     {
@@ -5580,12 +5584,14 @@ gtk_window_get_height (GtkSizeRequest      *widget,
 {
   GtkWindow *window;
   GtkWidget *child;
+  guint border_width;
 
   window = GTK_WINDOW (widget);
   child  = gtk_bin_get_child (GTK_BIN (window));
-  
-  *minimum_size = GTK_CONTAINER (window)->border_width * 2;
-  *natural_size = GTK_CONTAINER (window)->border_width * 2;
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
+  *minimum_size = border_width * 2;
+  *natural_size = border_width * 2;
 
   if (child && gtk_widget_get_visible (child))
     {
@@ -5616,7 +5622,7 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
   g_object_ref (window);
   g_object_ref (widget);
       
-  if (GTK_CONTAINER (widget->parent)->focus_child == widget)
+  if (gtk_container_get_focus_child (GTK_CONTAINER (widget->parent)) == widget)
     {
       child = window->focus_widget;
       
@@ -6401,7 +6407,7 @@ gtk_window_move_resize (GtkWindow *window)
 
 	  gdk_window_process_updates (widget->window, TRUE);
 
-	  if (container->resize_mode == GTK_RESIZE_QUEUE)
+	  if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
 	    gtk_widget_queue_draw (widget);
 	}
       else
@@ -6425,7 +6431,7 @@ gtk_window_move_resize (GtkWindow *window)
 	   * FIXME: we should also dequeue the pending redraws here, since
 	   * we handle those ourselves upon ->configure_notify_received==TRUE.
 	   */
-	  if (container->resize_mode == GTK_RESIZE_QUEUE)
+	  if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
 	    {
 	      gtk_widget_queue_resize_no_redraw (widget);
 	      _gtk_container_dequeue_resize_handler (container);
diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c
index fde4f0e..e725b7d 100644
--- a/gtk/tests/builder.c
+++ b/gtk/tests/builder.c
@@ -1026,14 +1026,14 @@ test_children (void)
   g_assert (vbox != NULL);
   g_assert (GTK_IS_VBOX (vbox));
   g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_WIDGET (vbox)->parent)), "dialog1") == 0);
-  g_assert (GTK_CONTAINER (vbox)->border_width == 10);
+  g_assert (gtk_container_get_border_width (GTK_CONTAINER (vbox)) == 10);
   g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_DIALOG (dialog)->vbox)), "dialog1-vbox") == 0);
 
   action_area = gtk_builder_get_object (builder, "dialog1-action_area");
   g_assert (action_area != NULL);
   g_assert (GTK_IS_HBUTTON_BOX (action_area));
   g_assert (GTK_WIDGET (action_area)->parent != NULL);
-  g_assert (GTK_CONTAINER (action_area)->border_width == 20);
+  g_assert (gtk_container_get_border_width (GTK_CONTAINER (action_area)) == 20);
   g_assert (GTK_DIALOG (dialog)->action_area != NULL);
   g_assert (gtk_buildable_get_name (GTK_BUILDABLE (GTK_DIALOG (dialog)->action_area)) != NULL);
   g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_DIALOG (dialog)->action_area)), "dialog1-action_area") == 0);
diff --git a/tests/gtkoffscreenbox.c b/tests/gtkoffscreenbox.c
index b6caa14..71b36db 100644
--- a/tests/gtkoffscreenbox.c
+++ b/tests/gtkoffscreenbox.c
@@ -234,13 +234,13 @@ gtk_offscreen_box_realize (GtkWidget *widget)
   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget);
   GdkWindowAttr attributes;
   gint attributes_mask;
-  gint border_width;
+  guint border_width;
   GtkRequisition child_requisition;
   int start_y = 0;
 
   gtk_widget_set_realized (widget, TRUE);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   attributes.x = widget->allocation.x + border_width;
   attributes.y = widget->allocation.y + border_width;
@@ -458,6 +458,7 @@ gtk_offscreen_box_size_request (GtkWidget      *widget,
 {
   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget);
   int w, h;
+  guint border_width;
 
   w = 0;
   h = 0;
@@ -482,8 +483,9 @@ gtk_offscreen_box_size_request (GtkWidget      *widget,
       h += CHILD2_SIZE_SCALE * child_requisition.height;
     }
 
-  requisition->width = GTK_CONTAINER (widget)->border_width * 2 + w;
-  requisition->height = GTK_CONTAINER (widget)->border_width * 2 + h;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  requisition->width = border_width * 2 + w;
+  requisition->height = border_width * 2 + h;
 }
 
 static void
@@ -491,13 +493,13 @@ gtk_offscreen_box_size_allocate (GtkWidget     *widget,
 				 GtkAllocation *allocation)
 {
   GtkOffscreenBox *offscreen_box;
-  gint border_width;
   gint start_y;
+  guint border_width;
 
   widget->allocation = *allocation;
   offscreen_box = GTK_OFFSCREEN_BOX (widget);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   if (gtk_widget_get_realized (widget))
     gdk_window_move_resize (widget->window,



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