? .gtktoolbar.c.swp
? gtktoolbar_with_API_setting_homogeneous.diff
Index: gtktoolbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.c,v
retrieving revision 1.84
diff -u -r1.84 gtktoolbar.c
--- gtktoolbar.c	26 Nov 2002 22:12:56 -0000	1.84
+++ gtktoolbar.c	19 Dec 2002 13:40:52 -0000
@@ -397,6 +397,8 @@
 
   toolbar->style_set = FALSE;
   toolbar->icon_size_set = FALSE;
+
+  toolbar->homogeneous_set = FALSE;
 }
 
 static void
@@ -661,13 +663,13 @@
 
   if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
     {
-      requisition->width += nbuttons * button_maxw;
+      //requisition->width += nbuttons * button_maxw;
       requisition->height += MAX (button_maxh, widget_maxh);
     }
   else
     {
       requisition->width += MAX (button_maxw, widget_maxw);
-      requisition->height += nbuttons * button_maxh;
+      //requisition->height += nbuttons * button_maxh;
     }
 
   /* Extra spacing */
@@ -753,8 +755,17 @@
 	  if (!GTK_WIDGET_VISIBLE (child->widget))
 	    break;
 
-	  alloc.width = toolbar->button_maxw;
-	  alloc.height = toolbar->button_maxh;
+	  if (toolbar->homogeneous_set)
+	    {
+	      alloc.width = toolbar->button_maxw;
+	      alloc.height = toolbar->button_maxh;
+	    }
+	  else
+	    {
+	      gtk_widget_get_child_requisition (child->widget, &child_requisition);
+	      alloc.width = child_requisition.width;
+	      alloc.height = child_requisition.height;
+	    }
 
 	  if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) 
 	    {
@@ -762,17 +773,17 @@
 		alloc.x = ltr_x;
 	      else
 		alloc.x = allocation->width - ltr_x - alloc.width;
-	      alloc.y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
+	      alloc.y = allocation->y + (allocation->height - alloc.height) / 2;
 	    }
 	  else
-	    alloc.x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
+	    alloc.x = allocation->x + (allocation->width - alloc.width) / 2;
 	  
 	  gtk_widget_size_allocate (child->widget, &alloc);
 
 	  if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
-	    ltr_x += toolbar->button_maxw;
+	    ltr_x += alloc.width;
 	  else
-	    alloc.y += toolbar->button_maxh;
+	    alloc.y += alloc.height;
 
 	  break;
 
@@ -791,17 +802,17 @@
 		alloc.x = ltr_x;
 	      else
 		alloc.x = allocation->width - ltr_x - alloc.width;
-	      alloc.y = allocation->y + (allocation->height - child_requisition.height) / 2;
+	      alloc.y = allocation->y + (allocation->height - alloc.height) / 2;
 	    }
 	  else
-	    alloc.x = allocation->x + (allocation->width - child_requisition.width) / 2;
+	    alloc.x = allocation->x + (allocation->width - alloc.width) / 2;
 
 	  gtk_widget_size_allocate (child->widget, &alloc);
 
 	  if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
-	    ltr_x += child_requisition.width;
+	    ltr_x += alloc.width;
 	  else
-	    alloc.y += child_requisition.height;
+	    alloc.y += alloc.height;
 
 	  break;
 
@@ -1518,6 +1529,23 @@
     gtk_widget_queue_resize (GTK_WIDGET (toolbar));
 
   return child->widget;
+}
+
+void
+gtk_toolbar_set_homogeneous (GtkToolbar     *toolbar,
+		             gboolean        value)
+{
+  g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
+
+  toolbar->homogeneous_set = value;
+}
+
+gboolean
+gtk_toolbar_get_homogeneous (GtkToolbar     *toolbar)
+{
+  g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), FALSE);
+
+  return toolbar->homogeneous_set;
 }
 
 void
Index: gtktoolbar.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbar.h,v
retrieving revision 1.31
diff -u -r1.31 gtktoolbar.h
--- gtktoolbar.h	9 Oct 2002 00:36:28 -0000	1.31
+++ gtktoolbar.h	19 Dec 2002 13:40:52 -0000
@@ -99,6 +99,8 @@
   
   guint            style_set : 1;
   guint            icon_size_set : 1;
+
+  guint            homogeneous_set : 1;
 };
 
 struct _GtkToolbarClass
@@ -212,6 +214,8 @@
 					gint             position);
 
 /* Style functions */
+void       gtk_toolbar_set_homogeneous       (GtkToolbar           *toolbar,
+					      gboolean              value);
 void       gtk_toolbar_set_orientation       (GtkToolbar           *toolbar,
 					      GtkOrientation        orientation);
 void       gtk_toolbar_set_style             (GtkToolbar           *toolbar,
@@ -223,6 +227,7 @@
 void       gtk_toolbar_unset_style           (GtkToolbar           *toolbar);
 void       gtk_toolbar_unset_icon_size       (GtkToolbar           *toolbar);
 
+gboolean        gtk_toolbar_get_homogeneous  (GtkToolbar           *toolbar);
 GtkOrientation  gtk_toolbar_get_orientation  (GtkToolbar           *toolbar);
 GtkToolbarStyle gtk_toolbar_get_style        (GtkToolbar           *toolbar);
 GtkIconSize     gtk_toolbar_get_icon_size    (GtkToolbar           *toolbar);
