[maemo-commits] [maemo-commits] r13934 - in projects/haf/trunk/gtk+: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Sep 20 14:51:04 EEST 2007
Author: tko
Date: 2007-09-20 14:51:01 +0300 (Thu, 20 Sep 2007)
New Revision: 13934

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gtk/gtkhbbox.c
Log:
Respect GtkBox::homogeneous property in hbbox

2007-09-20  Tommi Komulainen  <tommi.komulainen at nokia.com>

	* gtk/gtkhbbox.c (gtk_hbutton_box_get_children_sizes): Respect
	GtkBox::homogeneous property for size requisition and allocation.
	NB#66723


Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2007-09-20 11:50:58 UTC (rev 13933)
+++ projects/haf/trunk/gtk+/ChangeLog	2007-09-20 11:51:01 UTC (rev 13934)
@@ -1,5 +1,11 @@
 2007-09-20  Tommi Komulainen  <tommi.komulainen at nokia.com>
 
+	* gtk/gtkhbbox.c (gtk_hbutton_box_get_children_sizes): Respect
+	GtkBox::homogeneous property for size requisition and allocation.
+	NB#66723
+
+2007-09-20  Tommi Komulainen  <tommi.komulainen at nokia.com>
+
 	* gtk/gtkhbbox.c (gtk_hbutton_box_get_children_sizes,
 	gtk_hbutton_box_size_allocate): Call get_children_sizes with optional
 	allocation parameter so that we can use it for size requisition as

Modified: projects/haf/trunk/gtk+/gtk/gtkhbbox.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkhbbox.c	2007-09-20 11:50:58 UTC (rev 13933)
+++ projects/haf/trunk/gtk+/gtk/gtkhbbox.c	2007-09-20 11:51:01 UTC (rev 13934)
@@ -152,10 +152,12 @@
   total_width = *nvis_children * child_width;
   total_spacing = (*nvis_children - 1) * GTK_BOX (widget)->spacing;
 
-  if (allocation != NULL && total_width + total_spacing > allocation->width)
+  if (!gtk_box_get_homogeneous (GTK_BOX (widget)) ||
+      (allocation != NULL && total_width + total_spacing > allocation->width))
     {
-      /* homogeneous allocation too wide to fit container, shrink the buttons
-       * to their size requisition */
+      /* want heterogeneous allocation, or homogeneous allocation too wide to
+       * fit container, shrink the buttons to their size requisition
+       */
       GList *children;
       gint extra_space;
 
@@ -190,8 +192,15 @@
         }
 
       total_width = *primary_width + *secondary_width;
-      extra_space = allocation->width - (total_width + total_spacing);
 
+      /* Distribute the extra space between children when wanting to have
+       * homogeneous allocation
+       */
+      if (allocation && gtk_box_get_homogeneous (GTK_BOX (widget)))
+        extra_space = allocation->width - (total_width + total_spacing);
+      else
+        extra_space = 0;
+
       /* If extra space available, distribute it evenly to the buttons.
        * XXX: Smallest buttons should probably get the biggest share instead,
        *      to maximize button sizes and approximate homogeneous allocation.


More information about the maemo-commits mailing list