Ethereal-dev: Re: [Ethereal-dev] Patch to make the prompt to save capture dialog apreference

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

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Mon, 26 Apr 2004 19:14:28 +0200
Palmer Thomas J Civ HQ SSG/ENEM wrote:

Hi List,

In looking at how to add a "In the future, do not show this warning" checkbox to the dialog as Mr. Harris suggests, I can built a special dialog ( essentially a slightly modified copy of display_simple_dialog() ) that contains the checkbox. This would involve code duplication, is there a better way? Thanks in advance for your suggestions.
You should avoid code duplication in almost any cases. This will involve a lot of extra work when having to change several slightly different places at later changes.

Usually a good way to do this, is to implement all features in a single way and make if/switch at the points that differs.

Then you can have two / several simple wrapper functions, which "switches" the different features.

Regards, ULFL