[PATCH] Simplify dive tag checkbox code

Dirk Hohndel dirk at hohndel.org
Wed Apr 10 08:26:12 PDT 2013


Linus Torvalds <torvalds at linux-foundation.org> writes:

> On Wed, Apr 10, 2013 at 1:24 AM,  <subsurface at henrik.synth.no> wrote:
>> From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
>>
>> Getting rid of duplicated code when generating gtk check buttons.
>
> Good..
>
>> +       checkbox_tag(button, sbox, dive, DTAG_BOAT, _("Boat"));
>> +       checkbox_tag(button, sbox, dive, DTAG_SHORE, _("Shore"));
> ..
>
> Could we please also use the tag-name array? That way you could just
> do this all in a loop, but it would *also* avoid the need for
> unnecessary translations.

Done. 

Next I'll add code that ONLY shows the checkboxes if only one dive
is selected or all selected dives have the exact same set of tags.
Doing the "only change the ones that were the same value as the master
dive" logic here leads to rather hard to explain behavior :-)
(at least when trying to explain it to 'normal' users who aren't
developers or mathematicians...)

/D


More information about the subsurface mailing list