pidgin: 461ca4ad: Fix an off-by-one bug in calculating col...

sadrul at pidgin.im sadrul at pidgin.im
Mon Jun 9 15:35:44 EDT 2008


-----------------------------------------------------------------
Revision: 461ca4ad604d8daf5623802a51964339f0ad2d6e
Ancestor: 4332f4fcb2cf764aa2534891346eb29c326ab57a
Author: sadrul at pidgin.im
Date: 2008-06-09T19:32:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/461ca4ad604d8daf5623802a51964339f0ad2d6e

Modified files:
        finch/gntblist.c finch/libgnt/gnttree.c

ChangeLog: 

Fix an off-by-one bug in calculating column widths in trees.

-------------- next part --------------
============================================================
--- finch/gntblist.c	dc22e98b1be133fcce7af208888d9434faec6fb1
+++ finch/gntblist.c	111a8ba95e945b3d75b6333ef2783825507f2cc6
@@ -3033,9 +3033,6 @@ blist_show(PurpleBuddyList *list)
 	gnt_widget_set_position(ggblist->window, purple_prefs_get_int(PREF_ROOT "/position/x"),
 			purple_prefs_get_int(PREF_ROOT "/position/y"));
 
-	gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0,
-			purple_prefs_get_int(PREF_ROOT "/size/width") - 1);
-
 	gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree);
 
 	ggblist->status = gnt_combo_box_new();
============================================================
--- finch/libgnt/gnttree.c	da9097345382ec514a9eed6ceb2a6a98f95601e2
+++ finch/libgnt/gnttree.c	1021a728fcff3e6ba6e5ab1bda34dbfdca6c71de
@@ -110,13 +110,14 @@ readjust_columns(GntTree *tree)
 	gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL);
 	if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER))
 		width -= 2;
+	width -= 1;  /* Exclude the scrollbar from the calculation */
 	for (i = 0, total = 0; i < tree->ncol ; i++) {
 		if (tree->columns[i].flags & GNT_TREE_COLUMN_INVISIBLE)
 			continue;
 		if (tree->columns[i].flags & GNT_TREE_COLUMN_FIXED_SIZE)
-			width -= WIDTH(i) + 1;
+			width -= WIDTH(i) + (tree->priv->lastvisible != i);
 		else
-			total += WIDTH(i) + 1;
+			total += WIDTH(i) + (tree->priv->lastvisible != i);
 	}
 
 	if (total == 0)


More information about the Commits mailing list