[PATCH] gtk-gui.c: Move the download dialog related code to a new file

Dirk Hohndel dirk at hohndel.org
Thu Jan 10 12:06:48 PST 2013


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

> On Thu, Jan 10, 2013 at 11:02 AM, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>>
>> gtk-gui.c still has set_dc_nickname(), remember_dc(), etc., which will
>> contribute another 200 LOC or so to a eventual nickname.c.
>> i would personally have it in a separate file, but do as you see fit, i
>> guess.
>
> Having played around with the device stuff, I really *really* hate the
> games the nickname code plays with the system config. I left it alone
> for now, but as a person who works on his dive logs on multiple
> machines (notably my laptop when actually diving, and workstation when
> not), I've grown more and more convinced that the system config is
> horribly wrong. When I get different results on different machines,
> that just makes me angry.

The problem is that while you are a user of Subsurface I don't think you
are the typical user. Most people will use Subsurface on one system with
one (or a few) local XML files on that system.

I think the number of people who have a remote git server on which they
have their divelog XML file and connect to that git server from numerous
clients to then use a local installation of Subsurface against the local
copy of that remote XML file is... two (you and me).

So while I completely understand and comiserate with your anger - I
don't think I am willing to make changes that create a worse experience
for N-2 users only to create a better one for 2.

And even if 2 is wrong and there are a few dozen people like us - I
still think the vast majority of users DON'T use it like that.

> I've had this before (and we've discussed it with Dirk outside the
> mailing list), but the nickname code is even worse - because the
> system config has different rules from the xml quoting, the XML file
> can actually end up containing a different nickname than the system
> config. I could really not be bothered to do the config quoting thing
> for the xml file, it just seemed too ugly for words.

Yes, the quoting difference is stupid and annoying. Thankfully few
people think that adding commas or curly braces to their device names
provides significant value. I certainly didn't feel it was useful enough
to add additional encoding code to the config code.

But let me be very clear here - that code is hacky shit that should be
replaced with something much cleaner and more robust. It just happens to
work for me and in my limited time to work on Subsurface I preferred to
implement new things (like deco or the dive planner) instead of getting
the config code perfect.

mea culpa.

> Dirk disagrees about my hatred of system configs, though, and seems to
> want to have machine-wide defaults for some things, and remember dive
> computers across different peoples xml files.

Yes. I think for most people the use case works kind of like this

one system on which they run Subsurface
one main XML file that is their dive log
occasional other XML files if they want to test something or work with a
subset of their dives

Not having a system config means that if you use a file other than your
main XML file, all your settings are gone (and oh, btw - at least the
name of the default XML file name has to go into the system
config... you're in a catch22 otherwise).

To me getting different columns shown, different deco parameters,
different pO2 warning levels, etc, just because I use a different XML
file is just plain wrong and a SHITTY user experience. And if I were the
one proposing and implementing that and you for the first time opened an
empty file and suddenly got a different user experience you'd be yelling
your head off about the stupid brainless moron who pulled that piece of
shit code out of his ass.  (I hope this was an adequate approximation of
what you would say. If it was too soft spoken, I apologize - I'm not
used to acting like this in public)

> I'd rather get rid of our system config code entirely, and put it all
> into the per-xml file settings. And as a side effect, that would get
> rid of most of the remember_dc and set_dc_nickname stuff.

Yes it would. It would also get rid of a big chunk of the useability
improvements that we have made (e.g., default XML file) and would mean
that opening a different XML file means all the user's settings are
gone. That is not an acceptable trade-off to me.

Now we can, of course, talk about a different solution. Instead of
storing everything in the system config store only two file names there:
the default divelog XML file and the default settings XML file. And move
all other settings into the settings XML file, which you can share via
git (or not, if you prefer to have random default settings when starting
with an empty XML file). The amount of code required to do that would
actually be fairly small and it would create the same user experience
for Joe User (assuming we do this right) and would allow you to get your
very special "but Linus is different" feature. And heck, if I am wrong
and it is actually 20% of our users that behave like you then this is an
even bigger plus.

What do you think, would that address your issue?

Of course, the next question then becomes "what are the precedence rules
between the settings in the divelog file and the settings in the
settings file?" (my guess is the divelog file wins) and "when are things
stored in the settings file?" (they clearly are always stored in the
divelog file).

/D


More information about the subsurface mailing list