Index: gtk/gtkbox.c
===================================================================
--- gtk/gtkbox.c	(revision 20708)
+++ gtk/gtkbox.c	(working copy)
@@ -32,6 +32,7 @@
 
 enum {
   PROP_0,
+  PROP_ORIENTATION,
   PROP_SPACING,
   PROP_HOMOGENEOUS
 };
@@ -45,6 +46,17 @@ enum {
   CHILD_PROP_POSITION
 };
 
+
+typedef struct _GtkBoxPrivate GtkBoxPrivate;
+
+struct _GtkBoxPrivate
+{
+  GtkOrientation orientation;
+};
+
+#define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
+
+
 static void gtk_box_set_property (GObject         *object,
 				  guint            prop_id,
 				  const GValue    *value,
@@ -53,6 +65,12 @@ static void gtk_box_get_property (GObjec
 				  guint            prop_id,
 				  GValue          *value,
 				  GParamSpec      *pspec);
+
+static void gtk_box_size_request  (GtkWidget      *widget,
+                                   GtkRequisition *requisition);
+static void gtk_box_size_allocate (GtkWidget      *widget,
+                                   GtkAllocation  *allocation);
+
 static void gtk_box_add        (GtkContainer   *container,
 			        GtkWidget      *widget);
 static void gtk_box_remove     (GtkContainer   *container,
@@ -74,17 +92,21 @@ static void gtk_box_get_child_property (
 static GType gtk_box_child_type (GtkContainer   *container);
      
 
-G_DEFINE_ABSTRACT_TYPE (GtkBox, gtk_box, GTK_TYPE_CONTAINER)
+G_DEFINE_TYPE (GtkBox, gtk_box, GTK_TYPE_CONTAINER)
 
 static void
 gtk_box_class_init (GtkBoxClass *class)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
 
-  gobject_class->set_property = gtk_box_set_property;
-  gobject_class->get_property = gtk_box_get_property;
-   
+  object_class->set_property = gtk_box_set_property;
+  object_class->get_property = gtk_box_get_property;
+
+  widget_class->size_request = gtk_box_size_request;
+  widget_class->size_allocate = gtk_box_size_allocate;
+
   container_class->add = gtk_box_add;
   container_class->remove = gtk_box_remove;
   container_class->forall = gtk_box_forall;
@@ -92,7 +114,16 @@ gtk_box_class_init (GtkBoxClass *class)
   container_class->set_child_property = gtk_box_set_child_property;
   container_class->get_child_property = gtk_box_get_child_property;
 
-  g_object_class_install_property (gobject_class,
+  g_object_class_install_property (object_class,
+                                   PROP_ORIENTATION,
+                                   g_param_spec_enum ("orientation",
+                                                      P_("Orientation"),
+                                                      P_("The orientation of the box"),
+                                                      GTK_TYPE_ORIENTATION,
+                                                      GTK_ORIENTATION_HORIZONTAL,
+                                                      GTK_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class,
                                    PROP_SPACING,
                                    g_param_spec_int ("spacing",
                                                      P_("Spacing"),
@@ -102,7 +133,7 @@ gtk_box_class_init (GtkBoxClass *class)
                                                      0,
                                                      GTK_PARAM_READWRITE));
   
-  g_object_class_install_property (gobject_class,
+  g_object_class_install_property (object_class,
                                    PROP_HOMOGENEOUS,
                                    g_param_spec_boolean ("homogeneous",
 							 P_("Homogeneous"),
@@ -145,6 +176,8 @@ gtk_box_class_init (GtkBoxClass *class)
 								P_("The index of the child in the parent"),
 								-1, G_MAXINT, 0,
 								GTK_PARAM_READWRITE));
+
+  g_type_class_add_private (object_class, sizeof (GtkBoxPrivate));
 }
 
 static void
@@ -164,12 +197,15 @@ gtk_box_set_property (GObject         *o
 		      const GValue    *value,
 		      GParamSpec      *pspec)
 {
-  GtkBox *box;
-
-  box = GTK_BOX (object);
+  GtkBox *box = GTK_BOX (object);
+  GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
 
   switch (prop_id)
     {
+    case PROP_ORIENTATION:
+      private->orientation = g_value_get_enum (value);
+      gtk_widget_queue_resize (GTK_WIDGET (box));
+      break;
     case PROP_SPACING:
       gtk_box_set_spacing (box, g_value_get_int (value));
       break;
@@ -182,17 +218,20 @@ gtk_box_set_property (GObject         *o
     }
 }
 
-static void gtk_box_get_property (GObject         *object,
-				  guint            prop_id,
-				  GValue          *value,
-				  GParamSpec      *pspec)
+static void
+gtk_box_get_property (GObject         *object,
+                      guint            prop_id,
+                      GValue          *value,
+                      GParamSpec      *pspec)
 {
-  GtkBox *box;
-
-  box = GTK_BOX (object);
+  GtkBox *box = GTK_BOX (object);
+  GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
 
   switch (prop_id)
     {
+    case PROP_ORIENTATION:
+      g_value_set_enum (value, private->orientation);
+      break;
     case PROP_SPACING:
       g_value_set_int (value, box->spacing);
       break;
@@ -205,6 +244,357 @@ static void gtk_box_get_property (GObjec
     }
 }
 
+static void
+gtk_box_size_request (GtkWidget      *widget,
+                      GtkRequisition *requisition)
+{
+  GtkBox *box = GTK_BOX (widget);
+  GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
+  GtkBoxChild *child;
+  GList *children;
+  gint nvis_children;
+  gint width;
+  gint height;
+
+  requisition->width = 0;
+  requisition->height = 0;
+  nvis_children = 0;
+
+  children = box->children;
+  while (children)
+    {
+      child = children->data;
+      children = children->next;
+
+      if (GTK_WIDGET_VISIBLE (child->widget))
+	{
+	  GtkRequisition child_requisition;
+
+	  gtk_widget_size_request (child->widget, &child_requisition);
+
+	  if (box->homogeneous)
+	    {
+	      width = child_requisition.width + child->padding * 2;
+	      height = child_requisition.height + child->padding * 2;
+
+              if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                requisition->width = MAX (requisition->width, width);
+              else
+                requisition->height = MAX (requisition->height, height);
+	    }
+	  else
+	    {
+              if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                requisition->width += child_requisition.width + child->padding * 2;
+              else
+                requisition->height += child_requisition.height + child->padding * 2;
+	    }
+
+          if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+            requisition->height = MAX (requisition->height, child_requisition.height);
+          else
+            requisition->width = MAX (requisition->width, child_requisition.width);
+
+	  nvis_children += 1;
+	}
+    }
+
+  if (nvis_children > 0)
+    {
+      if (box->homogeneous)
+        {
+          if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+            requisition->width *= nvis_children;
+          else
+            requisition->height *= nvis_children;
+        }
+
+      if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+        requisition->width += (nvis_children - 1) * box->spacing;
+      else
+        requisition->height += (nvis_children - 1) * box->spacing;
+    }
+
+  requisition->width += GTK_CONTAINER (box)->border_width * 2;
+  requisition->height += GTK_CONTAINER (box)->border_width * 2;
+}
+
+static void
+gtk_box_size_allocate (GtkWidget     *widget,
+                       GtkAllocation *allocation)
+{
+  GtkBox *box = GTK_BOX (widget);
+  GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
+  GtkBoxChild *child;
+  GList *children;
+  GtkAllocation child_allocation;
+  gint nvis_children = 0;
+  gint nexpand_children = 0;
+  gint child_width = 0;
+  gint child_height = 0;
+  gint width = 0;
+  gint height = 0;
+  gint extra = 0;
+  gint x = 0;
+  gint y = 0;
+  GtkTextDirection direction;
+
+  widget->allocation = *allocation;
+
+  direction = gtk_widget_get_direction (widget);
+
+  for (children = box->children; children; children = children->next)
+    {
+      child = children->data;
+
+      if (GTK_WIDGET_VISIBLE (child->widget))
+	{
+	  nvis_children += 1;
+	  if (child->expand)
+	    nexpand_children += 1;
+	}
+    }
+
+  if (nvis_children > 0)
+    {
+      if (box->homogeneous)
+	{
+          if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+            {
+              width = (allocation->width -
+                       GTK_CONTAINER (box)->border_width * 2 -
+                       (nvis_children - 1) * box->spacing);
+              extra = width / nvis_children;
+            }
+          else
+            {
+              height = (allocation->height -
+                        GTK_CONTAINER (box)->border_width * 2 -
+                        (nvis_children - 1) * box->spacing);
+              extra = height / nvis_children;
+            }
+	}
+      else if (nexpand_children > 0)
+	{
+          if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+            {
+              width = (gint) allocation->width - (gint) widget->requisition.width;
+              extra = width / nexpand_children;
+            }
+          else
+            {
+              height = (gint) allocation->height - (gint) widget->requisition.height;
+              extra = height / nexpand_children;
+            }
+	}
+
+      if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+        {
+          x = allocation->x + GTK_CONTAINER (box)->border_width;
+          child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
+          child_allocation.height = MAX (1, (gint) allocation->height - (gint) GTK_CONTAINER (box)->border_width * 2);
+        }
+      else
+        {
+          y = allocation->y + GTK_CONTAINER (box)->border_width;
+          child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width;
+          child_allocation.width = MAX (1, (gint) allocation->width - (gint) GTK_CONTAINER (box)->border_width * 2);
+        }
+
+      children = box->children;
+      while (children)
+	{
+	  child = children->data;
+	  children = children->next;
+
+	  if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
+	    {
+	      if (box->homogeneous)
+		{
+		  if (nvis_children == 1)
+                    {
+                      child_width = width;
+                      child_height = height;
+                    }
+		  else
+                    {
+                      child_width = extra;
+                      child_height = extra;
+                    }
+
+		  nvis_children -= 1;
+		  width -= extra;
+                  height -= extra;
+		}
+	      else
+		{
+		  GtkRequisition child_requisition;
+
+		  gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
+		  child_width = child_requisition.width + child->padding * 2;
+		  child_height = child_requisition.height + child->padding * 2;
+
+		  if (child->expand)
+		    {
+		      if (nexpand_children == 1)
+                        {
+                          child_width += width;
+                          child_height += height;
+                        }
+		      else
+                        {
+                          child_width += extra;
+                          child_height += extra;
+                        }
+
+		      nexpand_children -= 1;
+		      width -= extra;
+                      height -= extra;
+		    }
+		}
+
+	      if (child->fill)
+		{
+                  if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                    {
+                      child_allocation.width = MAX (1, (gint) child_width - (gint) child->padding * 2);
+                      child_allocation.x = x + child->padding;
+                    }
+                  else
+                    {
+                      child_allocation.height = MAX (1, child_height - (gint)child->padding * 2);
+                      child_allocation.y = y + child->padding;
+                    }
+		}
+	      else
+		{
+		  GtkRequisition child_requisition;
+
+		  gtk_widget_get_child_requisition (child->widget, &child_requisition);
+                  if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                    {
+                      child_allocation.width = child_requisition.width;
+                      child_allocation.x = x + (child_width - child_allocation.width) / 2;
+                    }
+                  else
+                    {
+                      child_allocation.height = child_requisition.height;
+                      child_allocation.y = y + (child_height - child_allocation.height) / 2;
+                    }
+		}
+
+	      if (direction == GTK_TEXT_DIR_RTL &&
+                  private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                {
+                  child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
+                }
+
+	      gtk_widget_size_allocate (child->widget, &child_allocation);
+
+	      x += child_width + box->spacing;
+	      y += child_height + box->spacing;
+	    }
+	}
+
+      x = allocation->x + allocation->width - GTK_CONTAINER (box)->border_width;
+      y = allocation->y + allocation->height - GTK_CONTAINER (box)->border_width;
+
+      children = box->children;
+      while (children)
+	{
+	  child = children->data;
+	  children = children->next;
+
+	  if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget))
+	    {
+	      GtkRequisition child_requisition;
+
+	      gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
+              if (box->homogeneous)
+                {
+                  if (nvis_children == 1)
+                    {
+                      child_width = width;
+                      child_height = height;
+                    }
+                  else
+                    {
+                      child_width = extra;
+                      child_height = extra;
+                   }
+
+                  nvis_children -= 1;
+                  width -= extra;
+                  height -= extra;
+                }
+              else
+                {
+		  child_width = child_requisition.width + child->padding * 2;
+		  child_height = child_requisition.height + child->padding * 2;
+
+                  if (child->expand)
+                    {
+                      if (nexpand_children == 1)
+                        {
+                          child_width += width;
+                          child_height += height;
+                         }
+                      else
+                        {
+                          child_width += extra;
+                          child_height += extra;
+                        }
+
+                      nexpand_children -= 1;
+                      width -= extra;
+                      height -= extra;
+                    }
+                }
+
+              if (child->fill)
+                {
+                  if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                    {
+                      child_allocation.width = MAX (1, (gint)child_width - (gint)child->padding * 2);
+                      child_allocation.x = x + child->padding - child_width;
+                    }
+                  else
+                    {
+                      child_allocation.height = MAX (1, child_height - (gint)child->padding * 2);
+                      child_allocation.y = y + child->padding - child_height;
+                     }
+                }
+              else
+                {
+                  if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                    {
+                      child_allocation.width = child_requisition.width;
+                      child_allocation.x = x + (child_width - child_allocation.width) / 2 - child_width;
+                    }
+                  else
+                    {
+                      child_allocation.height = child_requisition.height;
+                      child_allocation.y = y + (child_height - child_allocation.height) / 2 - child_height;
+                    }
+                }
+
+	      if (direction == GTK_TEXT_DIR_RTL &&
+                  private->orientation == GTK_ORIENTATION_HORIZONTAL)
+                {
+                  child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
+                }
+
+              gtk_widget_size_allocate (child->widget, &child_allocation);
+
+              x -= (child_width + box->spacing);
+              y -= (child_height + box->spacing);
+	    }
+	}
+    }
+}
+
 static GType
 gtk_box_child_type (GtkContainer   *container)
 {
Index: gtk/gtkhbox.c
===================================================================
--- gtk/gtkhbox.c	(revision 20708)
+++ gtk/gtkhbox.c	(working copy)
@@ -21,37 +21,25 @@
  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
 #include "config.h"
 #include "gtkhbox.h"
-#include "gtkintl.h"
 #include "gtkalias.h"
 
 
-static void gtk_hbox_size_request  (GtkWidget      *widget,
-				    GtkRequisition *requisition);
-static void gtk_hbox_size_allocate (GtkWidget      *widget,
-				    GtkAllocation  *allocation);
-
-
 G_DEFINE_TYPE (GtkHBox, gtk_hbox, GTK_TYPE_BOX)
 
 static void
 gtk_hbox_class_init (GtkHBoxClass *class)
 {
-  GtkWidgetClass *widget_class;
-
-  widget_class = (GtkWidgetClass*) class;
-
-  widget_class->size_request = gtk_hbox_size_request;
-  widget_class->size_allocate = gtk_hbox_size_allocate;
 }
 
 static void
 gtk_hbox_init (GtkHBox *hbox)
 {
+  g_object_set (hbox, "orientation", GTK_ORIENTATION_HORIZONTAL, NULL);
 }
 
 GtkWidget*
@@ -68,244 +56,5 @@ gtk_hbox_new (gboolean homogeneous,
   return GTK_WIDGET (hbox);
 }
 
-
-static void
-gtk_hbox_size_request (GtkWidget      *widget,
-		       GtkRequisition *requisition)
-{
-  GtkBox *box;
-  GtkBoxChild *child;
-  GList *children;
-  gint nvis_children;
-  gint width;
-
-  box = GTK_BOX (widget);
-  requisition->width = 0;
-  requisition->height = 0;
-  nvis_children = 0;
-
-  children = box->children;
-  while (children)
-    {
-      child = children->data;
-      children = children->next;
-
-      if (GTK_WIDGET_VISIBLE (child->widget))
-	{
-	  GtkRequisition child_requisition;
-
-	  gtk_widget_size_request (child->widget, &child_requisition);
-
-	  if (box->homogeneous)
-	    {
-	      width = child_requisition.width + child->padding * 2;
-	      requisition->width = MAX (requisition->width, width);
-	    }
-	  else
-	    {
-	      requisition->width += child_requisition.width + child->padding * 2;
-	    }
-
-	  requisition->height = MAX (requisition->height, child_requisition.height);
-
-	  nvis_children += 1;
-	}
-    }
-
-  if (nvis_children > 0)
-    {
-      if (box->homogeneous)
-	requisition->width *= nvis_children;
-      requisition->width += (nvis_children - 1) * box->spacing;
-    }
-
-  requisition->width += GTK_CONTAINER (box)->border_width * 2;
-  requisition->height += GTK_CONTAINER (box)->border_width * 2;
-}
-
-static void
-gtk_hbox_size_allocate (GtkWidget     *widget,
-			GtkAllocation *allocation)
-{
-  GtkBox *box;
-  GtkBoxChild *child;
-  GList *children;
-  GtkAllocation child_allocation;
-  gint nvis_children;
-  gint nexpand_children;
-  gint child_width;
-  gint width;
-  gint extra;
-  gint x;
-  GtkTextDirection direction;
-
-  box = GTK_BOX (widget);
-  widget->allocation = *allocation;
-
-  direction = gtk_widget_get_direction (widget);
-  
-  nvis_children = 0;
-  nexpand_children = 0;
-  children = box->children;
-
-  while (children)
-    {
-      child = children->data;
-      children = children->next;
-
-      if (GTK_WIDGET_VISIBLE (child->widget))
-	{
-	  nvis_children += 1;
-	  if (child->expand)
-	    nexpand_children += 1;
-	}
-    }
-
-  if (nvis_children > 0)
-    {
-      if (box->homogeneous)
-	{
-	  width = (allocation->width -
-		   GTK_CONTAINER (box)->border_width * 2 -
-		   (nvis_children - 1) * box->spacing);
-	  extra = width / nvis_children;
-	}
-      else if (nexpand_children > 0)
-	{
-	  width = (gint) allocation->width - (gint) widget->requisition.width;
-	  extra = width / nexpand_children;
-	}
-      else
-	{
-	  width = 0;
-	  extra = 0;
-	}
-
-      x = allocation->x + GTK_CONTAINER (box)->border_width;
-      child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
-      child_allocation.height = MAX (1, (gint) allocation->height - (gint) GTK_CONTAINER (box)->border_width * 2);
-
-      children = box->children;
-      while (children)
-	{
-	  child = children->data;
-	  children = children->next;
-
-	  if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
-	    {
-	      if (box->homogeneous)
-		{
-		  if (nvis_children == 1)
-		    child_width = width;
-		  else
-		    child_width = extra;
-
-		  nvis_children -= 1;
-		  width -= extra;
-		}
-	      else
-		{
-		  GtkRequisition child_requisition;
-
-		  gtk_widget_get_child_requisition (child->widget, &child_requisition);
-
-		  child_width = child_requisition.width + child->padding * 2;
-
-		  if (child->expand)
-		    {
-		      if (nexpand_children == 1)
-			child_width += width;
-		      else
-			child_width += extra;
-
-		      nexpand_children -= 1;
-		      width -= extra;
-		    }
-		}
-
-	      if (child->fill)
-		{
-		  child_allocation.width = MAX (1, (gint) child_width - (gint) child->padding * 2);
-		  child_allocation.x = x + child->padding;
-		}
-	      else
-		{
-		  GtkRequisition child_requisition;
-
-		  gtk_widget_get_child_requisition (child->widget, &child_requisition);
-		  child_allocation.width = child_requisition.width;
-		  child_allocation.x = x + (child_width - child_allocation.width) / 2;
-		}
-
-	      if (direction == GTK_TEXT_DIR_RTL)
-		child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
-
-	      gtk_widget_size_allocate (child->widget, &child_allocation);
-
-	      x += child_width + box->spacing;
-	    }
-	}
-
-      x = allocation->x + allocation->width - GTK_CONTAINER (box)->border_width;
-
-      children = box->children;
-      while (children)
-	{
-	  child = children->data;
-	  children = children->next;
-
-	  if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget))
-	    {
-	      GtkRequisition child_requisition;
-	      gtk_widget_get_child_requisition (child->widget, &child_requisition);
-
-              if (box->homogeneous)
-                {
-                  if (nvis_children == 1)
-                    child_width = width;
-                  else
-                    child_width = extra;
-
-                  nvis_children -= 1;
-                  width -= extra;
-                }
-              else
-                {
-		  child_width = child_requisition.width + child->padding * 2;
-
-                  if (child->expand)
-                    {
-                      if (nexpand_children == 1)
-                        child_width += width;
-                      else
-                        child_width += extra;
-
-                      nexpand_children -= 1;
-                      width -= extra;
-                    }
-                }
-
-              if (child->fill)
-                {
-                  child_allocation.width = MAX (1, (gint)child_width - (gint)child->padding * 2);
-                  child_allocation.x = x + child->padding - child_width;
-                }
-              else
-                {
-		  child_allocation.width = child_requisition.width;
-                  child_allocation.x = x + (child_width - child_allocation.width) / 2 - child_width;
-                }
-
-	      if (direction == GTK_TEXT_DIR_RTL)
-		child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
-
-              gtk_widget_size_allocate (child->widget, &child_allocation);
-
-              x -= (child_width + box->spacing);
-	    }
-	}
-    }
-}
-
 #define __GTK_HBOX_C__
 #include "gtkaliasdef.c"
Index: gtk/gtkvbox.c
===================================================================
--- gtk/gtkvbox.c	(revision 20708)
+++ gtk/gtkvbox.c	(working copy)
@@ -21,36 +21,25 @@
  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
 #include "config.h"
 #include "gtkvbox.h"
-#include "gtkintl.h"
 #include "gtkalias.h"
 
 
-static void gtk_vbox_size_request  (GtkWidget      *widget,
-				    GtkRequisition *requisition);
-static void gtk_vbox_size_allocate (GtkWidget      *widget,
-				    GtkAllocation  *allocation);
-
 G_DEFINE_TYPE (GtkVBox, gtk_vbox, GTK_TYPE_BOX)
 
 static void
 gtk_vbox_class_init (GtkVBoxClass *class)
 {
-  GtkWidgetClass *widget_class;
-
-  widget_class = (GtkWidgetClass*) class;
-
-  widget_class->size_request = gtk_vbox_size_request;
-  widget_class->size_allocate = gtk_vbox_size_allocate;
 }
 
 static void
 gtk_vbox_init (GtkVBox *vbox)
 {
+  g_object_set (vbox, "orientation", GTK_ORIENTATION_VERTICAL, NULL);
 }
 
 GtkWidget*
@@ -67,233 +56,5 @@ gtk_vbox_new (gboolean homogeneous,
   return GTK_WIDGET (vbox);
 }
 
-
-static void
-gtk_vbox_size_request (GtkWidget      *widget,
-		       GtkRequisition *requisition)
-{
-  GtkBox *box;
-  GtkBoxChild *child;
-  GtkRequisition child_requisition;
-  GList *children;
-  gint nvis_children;
-  gint height;
-
-  box = GTK_BOX (widget);
-  requisition->width = 0;
-  requisition->height = 0;
-  nvis_children = 0;
-
-  children = box->children;
-  while (children)
-    {
-      child = children->data;
-      children = children->next;
-
-      if (GTK_WIDGET_VISIBLE (child->widget))
-	{
-	  gtk_widget_size_request (child->widget, &child_requisition);
-
-	  if (box->homogeneous)
-	    {
-	      height = child_requisition.height + child->padding * 2;
-	      requisition->height = MAX (requisition->height, height);
-	    }
-	  else
-	    {
-	      requisition->height += child_requisition.height + child->padding * 2;
-	    }
-
-	  requisition->width = MAX (requisition->width, child_requisition.width);
-
-	  nvis_children += 1;
-	}
-    }
-
-  if (nvis_children > 0)
-    {
-      if (box->homogeneous)
-	requisition->height *= nvis_children;
-      requisition->height += (nvis_children - 1) * box->spacing;
-    }
-
-  requisition->width += GTK_CONTAINER (box)->border_width * 2;
-  requisition->height += GTK_CONTAINER (box)->border_width * 2;
-}
-
-static void
-gtk_vbox_size_allocate (GtkWidget     *widget,
-			GtkAllocation *allocation)
-{
-  GtkBox *box;
-  GtkBoxChild *child;
-  GList *children;
-  GtkAllocation child_allocation;
-  gint nvis_children;
-  gint nexpand_children;
-  gint child_height;
-  gint height;
-  gint extra;
-  gint y;
-
-  box = GTK_BOX (widget);
-  widget->allocation = *allocation;
-
-  nvis_children = 0;
-  nexpand_children = 0;
-  children = box->children;
-
-  while (children)
-    {
-      child = children->data;
-      children = children->next;
-
-      if (GTK_WIDGET_VISIBLE (child->widget))
-	{
-	  nvis_children += 1;
-	  if (child->expand)
-	    nexpand_children += 1;
-	}
-    }
-
-  if (nvis_children > 0)
-    {
-      if (box->homogeneous)
-	{
-	  height = (allocation->height -
-		   GTK_CONTAINER (box)->border_width * 2 -
-		   (nvis_children - 1) * box->spacing);
-	  extra = height / nvis_children;
-	}
-      else if (nexpand_children > 0)
-	{
-	  height = (gint) allocation->height - (gint) widget->requisition.height;
-	  extra = height / nexpand_children;
-	}
-      else
-	{
-	  height = 0;
-	  extra = 0;
-	}
-
-      y = allocation->y + GTK_CONTAINER (box)->border_width;
-      child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width;
-      child_allocation.width = MAX (1, (gint) allocation->width - (gint) GTK_CONTAINER (box)->border_width * 2);
-
-      children = box->children;
-      while (children)
-	{
-	  child = children->data;
-	  children = children->next;
-
-	  if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
-	    {
-	      if (box->homogeneous)
-		{
-		  if (nvis_children == 1)
-		    child_height = height;
-		  else
-		    child_height = extra;
-
-		  nvis_children -= 1;
-		  height -= extra;
-		}
-	      else
-		{
-		  GtkRequisition child_requisition;
-
-		  gtk_widget_get_child_requisition (child->widget, &child_requisition);
-		  child_height = child_requisition.height + child->padding * 2;
-
-		  if (child->expand)
-		    {
-		      if (nexpand_children == 1)
-			child_height += height;
-		      else
-			child_height += extra;
-
-		      nexpand_children -= 1;
-		      height -= extra;
-		    }
-		}
-
-	      if (child->fill)
-		{
-		  child_allocation.height = MAX (1, child_height - (gint)child->padding * 2);
-		  child_allocation.y = y + child->padding;
-		}
-	      else
-		{
-		  GtkRequisition child_requisition;
-
-		  gtk_widget_get_child_requisition (child->widget, &child_requisition);
-		  child_allocation.height = child_requisition.height;
-		  child_allocation.y = y + (child_height - child_allocation.height) / 2;
-		}
-
-	      gtk_widget_size_allocate (child->widget, &child_allocation);
-
-	      y += child_height + box->spacing;
-	    }
-	}
-
-      y = allocation->y + allocation->height - GTK_CONTAINER (box)->border_width;
-
-      children = box->children;
-      while (children)
-	{
-	  child = children->data;
-	  children = children->next;
-
-	  if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget))
-	    {
-	      GtkRequisition child_requisition;
-	      gtk_widget_get_child_requisition (child->widget, &child_requisition);
-
-              if (box->homogeneous)
-                {
-                  if (nvis_children == 1)
-                    child_height = height;
-                  else
-                    child_height = extra;
-
-                  nvis_children -= 1;
-                  height -= extra;
-                }
-              else
-                {
-		  child_height = child_requisition.height + child->padding * 2;
-
-                  if (child->expand)
-                    {
-                      if (nexpand_children == 1)
-                        child_height += height;
-                      else
-                        child_height += extra;
-
-                      nexpand_children -= 1;
-                      height -= extra;
-                    }
-                }
-
-              if (child->fill)
-                {
-                  child_allocation.height = MAX (1, child_height - (gint)child->padding * 2);
-                  child_allocation.y = y + child->padding - child_height;
-                }
-              else
-                {
-		  child_allocation.height = child_requisition.height;
-                  child_allocation.y = y + (child_height - child_allocation.height) / 2 - child_height;
-                }
-
-              gtk_widget_size_allocate (child->widget, &child_allocation);
-
-              y -= (child_height + box->spacing);
-	    }
-	}
-    }
-}
-
 #define __GTK_VBOX_C__
 #include "gtkaliasdef.c"
Index: tests/testgtk.c
===================================================================
--- tests/testgtk.c	(revision 20708)
+++ tests/testgtk.c	(working copy)
@@ -8209,6 +8209,37 @@ flipping_toggled_cb (GtkWidget *widget, 
 }
 
 static void
+box_toggle_orientation (GtkBox *box)
+{
+  GtkOrientation orientation;
+  GList *children;
+  GList *child;
+
+  g_object_get (box, "orientation", &orientation, NULL);
+  g_object_set (box,
+                "orientation", (orientation == GTK_ORIENTATION_HORIZONTAL ?
+                                GTK_ORIENTATION_VERTICAL :
+                                GTK_ORIENTATION_HORIZONTAL),
+                NULL);
+
+  children = gtk_container_get_children (GTK_CONTAINER (box));
+
+  for (child = children; child; child = child->next)
+    {
+      if (GTK_IS_BOX (child->data))
+        box_toggle_orientation (child->data);
+    }
+
+  g_list_free (children);
+}
+
+void
+flipping_orientation_toggled_cb (GtkWidget *widget, gpointer data)
+{
+  box_toggle_orientation (GTK_BOX (GTK_DIALOG (gtk_widget_get_toplevel (widget))->vbox));
+}
+
+static void
 set_direction_recurse (GtkWidget *widget,
 		       gpointer   data)
 {
@@ -8261,9 +8292,24 @@ create_flipping (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "Bidirectional Flipping");
 
       check_button = gtk_check_button_new_with_label ("Right-to-left global direction");
+      gtk_container_set_border_width (GTK_CONTAINER (check_button), 10);
+      gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
+			  check_button, TRUE, TRUE, 0);
+
+      if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
+
+      g_signal_connect (check_button, "toggled",
+			G_CALLBACK (flipping_toggled_cb), NULL);
+
+      check_button = gtk_check_button_new_with_label ("Toggle orientation of all boxes");
+      gtk_container_set_border_width (GTK_CONTAINER (check_button), 10);
       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), 
 			  check_button, TRUE, TRUE, 0);
 
+      g_signal_connect (check_button, "toggled",
+			G_CALLBACK (flipping_orientation_toggled_cb), NULL);
+
       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), 
 			  create_forward_back ("Default", GTK_TEXT_DIR_NONE),
 			  TRUE, TRUE, 0);
@@ -8276,14 +8322,6 @@ create_flipping (GtkWidget *widget)
 			  create_forward_back ("Right-to-Left", GTK_TEXT_DIR_RTL),
 			  TRUE, TRUE, 0);
 
-      if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
-
-      g_signal_connect (check_button, "toggled",
-			G_CALLBACK (flipping_toggled_cb), NULL);
-
-      gtk_container_set_border_width (GTK_CONTAINER (check_button), 10);
-      
       button = gtk_button_new_with_label ("Close");
       g_signal_connect_swapped (button, "clicked",
 			        G_CALLBACK (gtk_widget_destroy), window);
