- if (gtk_widget_get_visible (child->widget))
- {
- nchildren += 1;
- gtk_widget_size_request (child->widget, &child_requisition);
-
- if (child_requisition.width + ipad_w > needed_width)
- needed_width = child_requisition.width + ipad_w;
- if (child_requisition.height + ipad_h > needed_height)
- needed_height = child_requisition.height + ipad_h;
- if (child->is_secondary)
- nsecondaries++;
- }
+ if (gtk_widget_get_visible (child))
+ {
+ nchildren += 1;
+ gtk_widget_get_preferred_size (child,
+ &child_requisition, NULL);
+ avg_w += child_requisition.width + ipad_w;
+ avg_h += child_requisition.height + ipad_h;
+ }
+ }
+ avg_w /= MAX (nchildren, 1);
+ avg_h /= MAX (nchildren, 1);
+
+ *widths = g_new (gint, nchildren);
+ *heights = g_new (gint, nchildren);
+
+ i = 0;
+ children = list;
+ while (children)
+ {
+ GtkWidget *child;
+ gboolean is_secondary;
+ gboolean non_homogeneous;
+
+ child = children->data;
+ children = children->next;
+
+ if (gtk_widget_get_visible (child))
+ {
+ is_secondary = gtk_button_box_get_child_secondary (bbox, child);
+ non_homogeneous = gtk_button_box_get_child_non_homogeneous (bbox, child);
+
+ if (is_secondary)
+ nsecondaries++;
+
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
+
+ if (homogeneous ||
+ (!non_homogeneous && (child_requisition.width + ipad_w < avg_w * 1.5)))
+ {
+ (*widths)[i] = -1;
+ if (child_requisition.width + ipad_w > needed_width)
+ needed_width = child_requisition.width + ipad_w;
+ }
+ else
+ {
+ (*widths)[i] = child_requisition.width + ipad_w;
+ }
+
+ if (homogeneous ||
+ (!non_homogeneous && (child_requisition.height + ipad_h < avg_h * 1.5)))
+ {
+ (*heights)[i] = -1;
+ if (child_requisition.height + ipad_h > needed_height)
+ needed_height = child_requisition.height + ipad_h;
+ }
+ else
+ {
+ (*heights)[i] = child_requisition.height + ipad_h;
+ }
+
+ i++;
+ }
+ }
+
+ g_list_free (list);
+
+ for (i = 0; i < nchildren; i++)
+ {
+ if ((*widths)[i] == -1)
+ (*widths)[i] = needed_width;
+ if ((*heights)[i] == -1)
+ (*heights)[i] = needed_height;