diff finch/gntft.c @ 18404:9a0f99ea664d

Resize tree-columns nicely when the tree is resized. We can tell it to set a fixed with for a column, or maintain the width-ratio when resizing.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 01 Jul 2007 12:21:30 +0000
parents 2d4df5ef0090
children d65ce3df5be2
line wrap: on
line diff
--- a/finch/gntft.c	Sun Jul 01 07:15:16 2007 +0000
+++ b/finch/gntft.c	Sun Jul 01 12:21:30 2007 +0000
@@ -178,6 +178,7 @@
 	GntWidget *button;
 	GntWidget *checkbox;
 	GntWidget *tree;
+	int widths[] = {8, 12, 8, 8, 8, 8, -1};
 
 	if (!xfer_dialog)
 		xfer_dialog = g_new0(PurpleGntXferDialog, 1);
@@ -195,12 +196,12 @@
 
 	xfer_dialog->tree = tree = gnt_tree_new_with_columns(NUM_COLUMNS);
 	gnt_tree_set_column_titles(GNT_TREE(tree), _("Progress"), _("Filename"), _("Size"), _("Speed"), _("Remaining"), _("Status"));
-	gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_PROGRESS, 8);
-	gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_FILENAME, 8);
-	gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_SIZE, 10);
-	gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_SPEED, 10);
-	gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_REMAINING, 10);
-	gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_STATUS, 10);
+	gnt_tree_set_column_width_ratio(GNT_TREE(tree), widths);
+	gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_PROGRESS, FALSE);
+	gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_SIZE, FALSE);
+	gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_SPEED, FALSE);
+	gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_REMAINING, FALSE);
+	gnt_widget_set_size(tree, 70, -1);
 	gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
 	gnt_box_add_widget(GNT_BOX(window), tree);