[PATCH 5/5] Only remember a DC nickname if the user has pressed OK

Linus Torvalds torvalds at linux-foundation.org
Thu Dec 20 22:07:40 PST 2012


On Thu, Dec 20, 2012 at 5:14 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> I still don't like this, as set_dc_nickname() gets called for every new
> dive. So if I say "ask me next time" then I'll get asked again, right
> away. Also, the text in the dialogbox is now of course wrong.

I think the whole nickname thing is wrong, and totally mis-designed.

It also (and for the same reason) makes the XML look like crap.

The nick-name shouldn't be some per-dive thing in the first place.
Which very much implies that it should *NOT* be saved in the
dive.divecomputer xml node.

So it shouldn't exist as a member of "struct divecomputer", and ti
shouldn't exist in the XML under the divecomputer thing. The
divecomputer node we have in the XML is a per-dive "this is the dive
computer data for this dive" thing. Not a "oh, and this is what I call
this dive computer, and let's repeat that information every single
time!"

I think a nickname for a dive computer may be a useful thing, but it
should either be in the config file, or if it's saved in the XML it
should be saved *separately* from the dives, and independently from
them. Not in the middle of the dive data, multiple times.

Then, in prodile.c, when you want to show the nickname of the dive
computer, you should *not* look at "dc->nickname". You should have a
lookup function that takes the dc model and deviceid, and looks it up
in that *separate* nickname table, and if it finds it there, show it
(otherwise show the model).

And giving nick-names to your dive computer should have ABSOLUTELY
NOTHING to do with downloading new dives. That whole confusion - again
- comes from thinking that nicknames are somehow associated with the
per-dive dive computer info. That whole model makes no sense. It's a
crazy model, and it results in these kinds of crazy confusions.

                Linus


More information about the subsurface mailing list