Ethereal-dev: Re: [Ethereal-dev] Column auto-resizing

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 3 Dec 2003 12:24:51 -0800

On Dec 3, 2003, at 10:48 AM, Ian Schorr wrote:

I guess the only issue I have with trying to "remember" the column widths is the same problem I have with other GUI items we're trying to "remember" - both the window position/sizse and file dialog directory "remembering" happens by setting prefs_write_needed to true. Unfortunately this means that if the user has these GUI options selected and one of them changes, Ethereal saves ALL current settings to the prefs file on exiting - including prefs that the user didn't necessarily want to change.

Or prefs that don't exist in earlier versions of Ethereal that one might be using when doing regression tests and the like.

Ethereal *should*, when writing the window position information, read in the existing preferences file, update *those* preferences, and write those values out. If not, that's a bug. However, that doesn't fix the problem I mentioned.

There's also the issue of what width columns should be by default - when no prefs exist for column widths, or a "new" column is added whose width has not been adjusted by the user yet.

MAX(width of column heading, wired-in width for columns for which we have such a width). Use the width of the string from "get_column_longest_string()" as the wired-in width.

If possible, arrange that the rightmost column (which will, in most cases, be the Info column) take up all the space left over from the other columns (I think that can be done with most GUI toolkits we'd be using). If a toolkit allows some column other than the rightmost column to be the "free hog" (to use the SunOS disk partitioning term), perhaps with that toolkit we should make the Info column be the "free hog".

I'm thinking this:

- "Remember" column widths in the prefs file, but change the way we're flushing prefs: (I suppose we could add "flags" for marking each pref that should be flushed on exit and written by write_prefs() on exit, but I'm thinking that perhaps there should be a new, seperate function for writing individual prefs that accepts a pref name and value.)

Or, alternatively, have a separate file to remember things that aren't explicitly set via Edit->Preference, such as window sizes and positions, column widths, last file selection box directory (and possibly, on platforms where the desktop environment has its own mechanism for saving information such as that, use that rather than a file).

If we supported a "recent items" list, that'd be the place to store it as well.

- Call the new function and save the column width(s) every time a column is resized.

Yes.

- Associate a "default" column width with each column type - I don't think a "general" default (i.e. each type of column gets, say, 100 pixels by default) makes any sense.

See above.

- Add a "Reset column widths" button to the Columns Preferences window

What does "Reset column widths" mean? Reset them to the "factory defaults"?

Is there a good reason that we can't dynamically add/remove columns from the packet list when added or removed by the user?

Because GtkClist isn't very friendly towards that, and we haven't bothered writing code to rebuild the clist - I was thinking of this as something to fix when doing the "virtual" list stuff, but if somebody wants to implement that, it's probably something reasonable to do until we have a "virtual" list.