[PATCH 1/2] Save all dive computer nicknames - whether used or not

Linus Torvalds torvalds at linux-foundation.org
Thu Jan 24 13:12:46 PST 2013


On Thu, Jan 24, 2013 at 12:58 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> I name my Uemis SDA "my Uemis" (I'm totally creative that way). Then
> Linus sends me his xml file linux.xml and he (being as creative as I am)
> named his Uemis SDA "my Uemis". When I open his file I will see his
> divecomputer as "my Uemis". I can then rename this (and save the file
> again), but the next time he sends me a new version of the file it will
> be back to his naming scheme.

So the solution for this in the new world order is to have a separate
XML file that has all the divecomputers in it. You can create it  it
with something like

  ( echo "<settings>"; \
    grep -h 'divecomputerid' *.xml | sort -u; \
    echo "</settings>" ) > divecomputers.xml

and then you can edit things to your hearts content. In fact, you can
edit it by just loading it from subsurface and use the dive computer
nickname editor, but you can obviously also do it in a text editor
(just remember to do the XML quoting if you do).

Then, you just do

    subsurface divecomputers.xml DirkDives.xml linus.xml

and it all JustWorks(tm).

And the *nice* thing about this is:

 - you can have *different* nicknames for when you load multiple
users' files. For example, when you look at just your dives, maybe you
want to call your dive computer just "Uemis Zurich". When you look at
both mine and yours, maybe you want to make the names explicit.

 - it is generic. You can have as many of these as you want, or as few
as you want. You can mix things up.

 - it's editable in a way that the f*cking gconftool-2 crap never was.

 - it doesn't corrupt the nicknames the way the string handling had
to. If you want to put the names in curly braces, go wild.

 - we can save things other than nicknames cleanly.

So I really *really* hate the old system config string. It was
horrible in so many ways, and it's actually much less flexible than
the XML file is.

                  Linus


More information about the subsurface mailing list