[PATCH] Fix eel wrap table column calculation



From bug 155642 [1]/bug 309938 [2,3].

Proposed patch attached.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=155642
[2] http://bugzilla.gnome.org/show_bug.cgi?id=309938
[3] http://bugzilla.gnome.org/attachment.cgi?id=48911&action=view

-- 
Christian Neumair <chris gnome-de org>
Index: eel/eel-wrap-table.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-wrap-table.c,v
retrieving revision 1.21
diff -u -p -r1.21 eel-wrap-table.c
--- eel/eel-wrap-table.c	24 Jan 2005 11:23:04 -0000	1.21
+++ eel/eel-wrap-table.c	11 Jul 2005 14:32:58 -0000
@@ -497,9 +497,10 @@ wrap_table_get_num_fitting (int availabl
 {
 	int num;
 
-  	g_return_val_if_fail (available >= 0, 0);
   	g_return_val_if_fail (max_child_size > 0, 0);
   	g_return_val_if_fail (spacing >= 0, 0);
+
+	available = MAX (available, 0);
 	
 	num = (available + spacing) / (max_child_size + spacing);
 	num = MAX (num, 1);
@@ -523,7 +524,8 @@ wrap_table_layout (EelWrapTable *wrap_ta
 	pos.x = content_bounds.x0;
 	pos.y = content_bounds.y0;
 
-	num_cols = wrap_table_get_num_fitting (GTK_WIDGET (wrap_table)->allocation.width,
+	num_cols = wrap_table_get_num_fitting (GTK_WIDGET (wrap_table)->allocation.width -
+					       GTK_CONTAINER (wrap_table)->border_width * 2,
 					       wrap_table->details->x_spacing,
 					       max_child_dimensions.width);
 	if (num_cols != wrap_table->details->cols) {
@@ -674,7 +676,8 @@ wrap_table_get_content_dimensions (const
 		max_child_dimensions.width = MAX (max_child_dimensions.width, 1);
 		max_child_dimensions.height = MAX (max_child_dimensions.height, 1);
 
-		num_cols = wrap_table_get_num_fitting (dimensions.width,
+		num_cols = wrap_table_get_num_fitting (dimensions.width -
+						       GTK_CONTAINER (wrap_table)->border_width * 2,
 						       wrap_table->details->x_spacing,
 						       max_child_dimensions.width);
 		num_rows = num_children / num_cols;

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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