Add missing strings for translations

Mostly in new code, but some of them are strings in older code that have
been missed in the past.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Support the webservice API update

Also make sure to pass the "Accept" request header
set to "text/xml", so that XML is retrieved.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Show Gradient Factors in plot when showing calculated ceilings

This adds the GFlow/high values used to calculate the ceiling (if any).
Right now it shows those numbers even if at no point of the dive there was
an actual ceiling (but only if showing the ceiling itself is enabled).

This should make it easier to for the user to make sense of the calculated
ceiling, especially if posting screen shots.

As an aside - for some dive computers like the OSTC and the Shearwaters we
should be able to also plot the GF used by its calculation which might be
interesting for comparison purposes, as both of them also give us the
ceiling (lowest deco stop) calculated during the dive..

See #13

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Display air pressure in the Info notebook

I can't find it in myself to care enough to display this in other units.
mm/Hg anyone? I didn't think so.

We still can't edit this value, but at least if w are able to read it from
the dive computer we also show it to the user.

See #19

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix cursor up/down logic

The dive selection rewrite didn't set the selected dive index, breaking
the cursor key logic.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't deselect all dives on all selection "change" events

gtk sends the selection change events all the time, for pretty much any
"divelist changed - so selection changed".  The expansion of a trip, the
switch to a new model, yadda yadda.  But we actually want selections to
be sticky across these events, so we can't just forget all of our old
selection state and repopulate it.

So we re-introduce the "am I allowed to change this row" callback, which
we used to use to create a list of every actual selection that was
changed.  But instead of remembering the list (and having the stale
entries issue with that remembered list that caused problems), we now
just use that as a "that *particular* selection cleared" event.

So this callback works as the "which part of the visible, currently
selected state got cleared" notifier, and handles unselection.

Then, when the selection is over, we use the new model of "let's just
traverse the list of things gtk thinks are selected" and use that to
handle new selections in the visible state that gtk actually tracks
well.  So that logic handles the new selections.

This way, dives that aren't visible to gtk don't ever get modified: gtk
won't ask about them being selected or not, and gtk won't track them in
its selection logic, so with this model their state never changes for
us.

gtk selections are annoying.  They are simple for the case gtk knows
about (ie they are *visually* selected in the GUI), but since we very
much want to track selection across events that change the visual state,
we need to have this insane "impedance match".

Reported-by: Dirk Hohdnel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make the selection logic more robust

In commit 304526850c91 ("Don't deselect all dives on all selection
"change" events") the handling of "selected_dive" is incorrect. We ended
up with non-sensical values for the selected dive, including dives that
Gtk didn't think were selected.

This commit tries to be smart about what to do when the dive that we
currently consider selected is unselected (we have this weird notion of
many dives being selected, but one of them is shown in the profile and
that is the "selected_dive"). As long as there are others selected, we
pick one of them (first walking to earlier dives and if there are none
that are selected, looking for a later dive) as the new selected dive.

This appears to give us a rather intuitive behavior when playing with
multiple selected dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Massive cleanup

Mostly coding style and whitespace changes plus making lots of functions
static that have no need to be extern. This also helped find a bit of code
that is actually no longer used.

This should have absolutely no functional impact - all changes should be
purely cosmetic. But it removes a bunch of lines of code and makes the
rest easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>