Ethereal-dev: [Ethereal-dev] Clist Auto-resize change suggestion

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ian Schorr <spamcontrol2@xxxxxxxxxxx>
Date: Tue, 24 Jun 2003 18:27:11 -0400
Currently the gtk-clist code appears to automatically choose "optimal" column widths (based on the width of the cell itself) after loading a new file. In my own experience, I often load traces that contain or or more frames that have "Info" cell widths of several thousand pixels (long CIFS filenames, many streamed NFS requests/replies, etc, end up containing quite a few characters). This means that the Info column is auto-sized to several thousand pixels as well, either forcing me to spend a long time manually resizing the column, or preventing me from using columns on the right-side of the Info column.

I'd like to suggest capping the auto-resize to something reasonable. I've chosen 600 pixels in this case. I've attached a patch (which is really just a two-line change - I just check for "MIN(gtk_clist...., MAX_COLUMN_AUTOSIZE_WIDTH)" when assigning a value to "width", within gtk_clist_set_column_auto_resize. Let me know if I've missed anything.)

Ideally, I'd like to see column sizes saved in preferences and stay constant between new file opens. I'm not sure the best way to do this - how "bad" would it be to auto-save every time a column is resized? Is there a better way?

In fact, it would probably be best to give the users an option between the two - perhaps an "Enable column auto-sizing" under column preferences. However, I'd recommend capping the auto-sizing of columns to a reasonable maximum in this case as well.

Ian
45a46,48
> /* maximum size in pixels that columns will be autosized to */
> #define MAX_COLUMN_AUTOSIZE_WIDTH 600
> 
1668c1671,1673
< 	  width = gtk_clist_optimal_column_width (clist, column);
---
> 	  /* cap the auto-resized width to something reasonable to prevent the column from potentially
>              becoming thousands of pixels wide */
> 	  width = MIN(gtk_clist_optimal_column_width (clist, column), MAX_COLUMN_AUTOSIZE_WIDTH);