Commit graph

271 commits

Author SHA1 Message Date
Dirk Hohndel
d3570508b1 Move planner UI into planner.c
There should be NO other changes in this commit - just moving the code and
adjusting the includes (and adding the entry point to display-gtk.h).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-07 11:23:14 -08:00
Dirk Hohndel
989cf37fcf Remove the now obsolete hard coded test_plan
This was just a crutch to get something out there for people to play with.
With the ability to input a plan in place this is now obsolete.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-07 08:51:26 -08:00
Dirk Hohndel
85ed689dc0 Support relative times in diveplanner input "on the fly" mode
This had gotten lost when updating the profile on the fly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-07 08:13:23 -08:00
Dirk Hohndel
be9be189f7 Display dive profile of the dive we plan, as we plan it
As the user enters data into the entry fields, that data is validated and
as soon as there is enough data we start constructing a dive profile,
including the final ascent to the surface, including required deco stops,
etc.

This commit still has some serious issues.

- when data is input that doesn't validate, we just print a warning to
  stdout - instead we need to change the backgroundcolor of the input
  field or something.
- when we switch to the last dive in order to show the profile we don't
  actually search for the last dive - we just show the first one in the
  tree. This works for the default sort order but is of course wrong
  otherwise

I'm sure there are many other bugs, but I want to push it out where it is
right now for others to be able to take a look.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-06 22:15:03 -08:00
Dirk Hohndel
fb99c9a163 Remove Linus' plan input UI
This was added in commit 594da00612ab "Do a minimal hook-up of the dive
plan tree view to the actual planning" and has been replaced by a
different UI in subsequent commits. No point in keeping it around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-06 15:10:39 -08:00
Lubomir I. Ivanov
c607f09f40 Planner: hook the gas combo box to a "focus-out" event handler
GTK's logic might be a bit flawed (or complicated) in terms of
"focus-out-event" and GtkComboBoxEntry objects as it does not work
by attaching said signal type directly to the GtkComboBoxEntry.
Perhaps it only makes sense for text input.

Since "focus-out-event" works for GtkEntry, we can retrieve the child
GtkEntry from the combo using gtk_bin_get_child(GTK_BIN(combo)
and attach the event handler to that.

This change should make it possible to update gas_model (GtkListStore)
when changing the widget focus with both the keyboard and mouse clicks.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-06 09:55:34 -08:00
Dirk Hohndel
6d10aab049 Make the dive plan input much more compact
Have the frames just for the top row and get rid of all of the extra space
in the layout.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-05 23:35:41 -08:00
Dirk Hohndel
b08f51cfc6 Add new gases to the combo box in dive plan entry
Once again Gtk does everything it can to make our lives miserable. It
requires major hackery to be able to add new gases to the drop down lists
"on the fly". Right now this only works if you edit the gas and then use
Tab to move to the next field.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-05 23:14:42 -08:00
Dirk Hohndel
b1dc9bf26d Make the 'Add waypoint' button work in the Input Plan dialog
Just after pushing out the last set of changes I had one more idea what I
could try. And of course that was it. Don't queue up a redraw. Simply run
gtk_widget_show_all on the dialog! That does the trick.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-05 22:19:21 -08:00
Dirk Hohndel
3ac1cdf9e4 Different widget to input the plan
Linus' treeview for the plan input is just too ugly for words. And doesn't
work, either.

So let's go with plan C: a table of waypoint entries. Depth, duration (or
absolute time), and gas used. The gas is a combobox that does completion.
I am reusing Linus' validation functions / parsers.

This works if you can fit your dive into the four waypoints that are there
by default. The add waypoint button is hooked up but even though it does
what I think should modify the dialog that is currently displayed that
clearly doesn't work.

But at least it "mostly" works and isn't as horrifyingly uggly as the
first two attempts.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-05 21:56:13 -08:00
Linus Torvalds
92a8fde9c2 Do a minimal hook-up of the dive plan tree view to the
actual planning

Yes, you can actually enter your segments now.

No, it's not wonderfully user-friendly.  If you don't enter enough
segments to create a dive plan, it will just silently fail, for example.
And the <tab> key that should get you to the next editable segment
doesn't.  And so on.  But it kind of works.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-05 15:51:57 -08:00
Linus Torvalds
f31b836836 Create the infrastructure for a dive plannder based on a tree-model
This doesn't actually do the real work yet, but it creates all the
infrastructure to edit a tree model, and verify the contents for time,
depth and gas mix.

Now we just need the ability to add entries to the tree model (this adds
one fake one, just to test the editing), and then read out the final end
result and turn it into a plan.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-05 15:51:53 -08:00
Dirk Hohndel
8c3d07816f Stub out a few things for a plan input UI
This is not doing anything (which is why there are so many unused variable
warnings). It's just a couple of entries lined up to give a visual
impression how some of this could look.

I am not a UI designer. And there are good reasons for that...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-05 10:09:07 -08:00
Dirk Hohndel
cca847791a First stab at simplistic dive planning
This comes with absolutely no gui - so the plan literally needs to be
compiled into Subsurface. Not exactly a feature, but this allowed me to
focus on the planning part instead of spending time on tedious UI work.

A new menu "Planner" with entry "Test Planner" calls into the hard-coded
function in planner.c. There a simple dive plan can be constructed with
calls to plan_add_segment(&diveplan, duration, depth at the end, fO2, pO2)

Calling plan(&diveplan) does the deco calculations and creates deco stops
that keep us below the ceiling (with the GFlow/high values currently
configured). The stop levels used are defined at the top of planner.c in
the stoplevels array - there is no need to do the traditional multiples of
3m or anything like that.

The dive including the ascents and deco stops all the way to the surface
is completed and then added as simulated dive to the end of the divelist
(I guess we could automatically select it later) and can be viewed.

This is crude but shows the direction we can go with this. Envision a nice
UI that allows you to simply enter the segments and pick the desired
stops.

What is missing is the ability to give the algorithm additional gases that
it can use during the deco phase - right now it simply keeps using the
last gas used in the diveplan.

All that said, there are clear bugs here - and sadly they seem to be in
the deco calculations, as with the example given the ceiling that is
calculated makes no sense. When displayed in smooth mode it has very
strange jumps up and down that I wouldn't expect. For example with GF
35/75 (the default) the deco ceiling when looking at the simulated dive
jumps from 16m back up to 13m around 14:10 into the dive. That seems very
odd.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-04 23:56:55 -08:00
Dirk Hohndel
6dc247ff78 Fix deco calculations to correctly use GF values and add CC support
The old implementation was broken in several ways.

For one thing the GF values are percentages, so they should normally be
0 < GF < 1 (well, some crazy people like to go above that).

With this most of the Bühlmann config constants were wrong.

Furthermore, after we adjust the pressure tolerance based on the gradient
factors, we need to convert this back into a depth (instead of passing
back the unmodified depth - oops).

Finally, this commit adds closed circuit support to the deco calculations.

Major progress and much more useful at this stage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-04 11:13:14 -08:00
Dirk Hohndel
75b970f7ac Intercept all events to the GF fields in the property dialog
This seems like a strange way to capture the FOCUS_CHANGE event, but
manually trying to register a callback for it fails. Yet registering a
callback for every event and then filtering for FOCUS_CHANGE in the
callback works. Go figure.

But with this commit you can actually change the GF settings in the
preferences dialog and once you tab out of the entry field the change gets
immediately applied - nice to play with the effects of changing GF values.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-04 11:12:32 -08:00
Dirk Hohndel
f93f578eca Merge branch 'deco2'
Bringing in the first attempts to do our own deco calculations
2013-01-03 21:58:46 -08:00
Lubomir I. Ivanov
fc882f574f Improvements to select_prev_dive() and select_next_dive()
There were some minor problems when moving the selection
cursor around:

1) If the selection was larger than 1, it was possible
for the selection to get "stuck" in the middle of the list.

This patch approaches this by always calling
gtk_tree_selection_unselect_all() before
gtk_tree_selection_select_iter(), or simply always making
sure we have one selected iterator when navigating with the keys.

2) When there was a single top level dive before the first trip
it wasn't possible to navigate trough the child dives of said
trip in both directions.

The patch attempts to fix this by having the hunks/checks:
if (idx < 0) {

(idx is of a trip) performed regardless of other conditions.

*** Note: testing was done by importing all test*.xml
dives with auto-group on.

[Dirk Hohndel: adjusted the patch to also fix on_key_press to only grab
               the key if no modifier key is pressed; otherwise this
	       breaks shift-cursor-keys for selecting multiple dives.]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 21:52:30 -08:00
Dirk Hohndel
9cd18c43aa Make GF values configurable
There are a couple of issues with this commit:

GtkEntry should emit the 'changed' signal when it is modified (so that
changes in the preferences get applied right away) - but that doesn't
appear to be working consistently.

Also, this doesn't appear to affect the deco of any dives that I try it
with. So my guess is something is wrong with the underlying deco
algorithm. That's diappointing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 21:41:35 -08:00
Dirk Hohndel
5ba250bd48 Use gradient factors in deco calculation
Usually dive computers show the ceiling in terms of the next deco stop -
and those are in 3m increments. This commit also adds the ability to chose
either the typical 3m increments or the smooth ceiling that the Bühlmann
algorithm actually calculates.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 20:44:37 -08:00
Dirk Hohndel
aab67e2a5b Add configurable visualization of calculated ceiling
This is on top of the deco information reported by the dive computer (in a
different color - currently ugly green). The user needs to enable this via
the Tec page of the preferences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 20:43:19 -08:00
Dirk Hohndel
6f8e9bcff3 Rewrite the nickname replacement function
This function had a couple of bugs. Two different off by one errors and on
top of that it was matching only the deviceid instead of model and
deviceid.

So I simply rewrote it to match against the full pattern and take a much
more straight forward approach to replacing the entry for the divecomputer
under consideration. If the new nickname is entry this implementation
allocates one extra byte - but that didn't seem worth the extra code to
fix it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 12:33:48 -08:00
Dirk Hohndel
a319d66c4a Use old style (pre gtk-2.22) keysyms
And include the compatibility header to build on newer versions.

Reported-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-02 13:01:02 -08:00
Dirk Hohndel
a58d470bad Remove autogroup from the preferences and store per file instead
Having two spots to toggle autogroup had always been a clear sign of
insanity. The inconsistent ludicrous semantic of when we remembered the
state of autogroup was even worse.

This finally gets rid of that disaster and drops the autogroup setting
from the preferences and makes it instead a per file property. When you
save a file, it saves the state of the autogroup toggle. This seems much
more useful - you may have files where you want to create trips by
default. And others, where you don't.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-01 17:29:38 -08:00
Dirk Hohndel
030d0c1294 Make sure remember_dc has its own copy of the model string
When called from the parser the model string is freed right after passing
it to remember_dc. So we need to get our own copy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-01 17:27:33 -08:00
Dirk Hohndel
8fa81a5577 Add ability to remove a divecomputer from our data structures
Right now this isn't used but it will be needed for the yet to be written
UI to manage our divecomputer database.

This commit also fixes an oversight in the remember_dc function. Updates
to nicknames weren't committed to the config.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-01 13:30:20 -08:00
Dirk Hohndel
8f364d0094 Use the Left and Right keys to switch between divecomputers
The existing code had the somewhat retarded Ctrl-C binding for displaying
the next divecomputer and no way to go back to the previous one. With this
commit we use our keyboard grab to map Left and Right to previous and next
divecomputer. Much nicer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-01 10:20:22 -08:00
Dirk Hohndel
91ca0d2cf6 First step towards grabbing keys and handling them ourselves
This commit steals the cursor up and down keys away from gtk so regardless
where gtk thinks the focus may be, we can still use the keys to change
between dives.

In the current UI design where all editing happens in separate windows
this works as expected, as we only grab the keys for the main window. If
we manage to re-enable in-place editing then we need to make sure that
this doesn't cause problems (as gtk uses up/down for the ability to change
drop down selections in combo boxes or values in spin buttons. So we must
make sure that we stop stealing these keys once we start editing something
(in which case simply switching to the next/prev dive wouldn't be a good
thing, anyway).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-01 08:24:42 -08:00
Dirk Hohndel
df0ea07292 Fix nickname saving in XML file to deal with utf8 characters
This makes the whole code much cleaner and simpler.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-30 20:27:01 -08:00
Linus Torvalds
3b136f23ee Make add_dc_to_string() skip redundant entries
There is no point writing out divecomputer nicknames that do not exist
(or that match the dive computer model), so don't.

Also, make the function to do this static to save-xml.c, which is the
only user (I initially didn't _find_ the function to create the XML
string because it was illogically hidden in gtk-gui.c), and change the
calling convention to be more direct (pass in a string and return a
result, rather than modify a "pointer to string").

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-28 09:04:59 -08:00
Dirk Hohndel
3872921ffe Divecomputer entries with deviceid 0 should be ignored for nicknames
Those only come from a number of development versions of Subsurface that
didn't include the deviceid in the divecomputer entry. There is no way of
telling different dive computers (of the same model) apart, so assigning a
nickname to such an entry then creates incorrect output when loading an
XML file from someone else (e.g. Linus and I both have a Uemis SDA and
both may have entries for our own SDA with deviceid 0; then the nickname
Subsurface shows for any Uemis SDA entry with a deviceid of 0 depends on
whether I last loaded his XML file or mine; that makes no sense).

This should only affect the develoers who stored XML files with one of the
development version of Subsurface that didn't store deviceids.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-28 06:36:47 -08:00
Dirk Hohndel
f6fb882337 Fix incorrect memory access in nickname handling
There was one code path where we didn't strdup the nickname - and this got
triggered when parsing XML files with divecomputerid entries for dive
computers that were already in the config. The nickname is then replaced
with the nickname from the parser - and that memory is later reused...

We should cleanup that nickname, anyway, and that also takes care of
making sure we have our own copy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-27 21:41:12 -08:00
Dirk Hohndel
e726c9d65c Add settings section to XML file format and store dive computer IDs
We only store the model/deviceid/nickname for those dive computers that
are mentioned in the XML file. This should make the XML files nicely
selfcontained.

This also changes the code to consistently use model & deviceid to
identify a dive computer. The deviceid is NOT guaranteed to be collision
free between different libdivecomputer backends...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-26 16:46:21 -08:00
Dirk Hohndel
1bd6f72d31 Different is different from the same (fix silly bug in nickname handling)
Trying to simplify the API for nickname handling I went a bit too far. We
indeed need to different API calls, one that returns an entry in the
nicknamelist for the deviceid that we have. And one that looks if there is
an entry for a different deviceid but the same model that we have.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-23 09:06:23 -08:00
Dirk Hohndel
06cd494a2f Next improvement of the nickname code
Now it is able to replace nicknames for existing entries (which will be
needed by the yet to be written UI).

This commit fixes a couple issues with the previous code:
- a potential SIGSEGV with malformed config entries
- missing closing parenthesis in the dialog box text

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-22 21:38:07 -08:00
Lubomir I. Ivanov
8639e14835 Make it possible to translate strings containing subscript "2"
The "Tec settings" dialog contains some strings with the
subscript "2" character, which have to be translated. While
the "2" is part of the string xgettext doesn't seem to recognize
such. To trick it we use a temporary buffer and c-format:

sprintf(utf8_buf, _("Show pO%s graph"), UTF8_SUBSCRIPT_2);
button = gtk_check_button_new_with_label(utf8_buf);

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-22 20:21:51 -08:00
Lubomir I. Ivanov
ba223798d3 Free some nickname related memory in gtk-gui.c
init_ui():
We add the char pointer "conf_copy" and free it afterwards, since
once "next_token" is changed it no longer points to the allocated heap
location the mapper returned.

[Dirk Hohndel: original patch rewritten to have better variable names and
 to match the recent changes to this code]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-22 20:19:51 -08:00
Dirk Hohndel
50aa6d1afa Imrpove the nickname handling
We now store the model information together with the deviceid and nickname
in order to be able to check if we have a record for any dive computer
with the same model (as that now triggers our nickname dialog).

This changes the format of the config entries for nicknames - the best
solution might be to just delete those and start again.

What is still missing is the code to store the nicknames in the XML file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-22 20:14:34 -08:00
Dirk Hohndel
8d2abc05f6 Remove nickname from divecomputer data structure
Having it there with the model information seemed to make sense but on
second thought it's the wrong spot to keep that information, especially
since we were storing it in the XML file in every single dive.

This change removes the nickname member from the divecomputer and makes
the rest of the code reasonably self consistent. It does not add much of
the new code for the new design to handle nicknames.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-21 20:58:47 -08:00
Linus Torvalds
d8fd8b2099 Add a "View next dive computer" menu item
This adds the capability to actually view all your dive computers, by
adding a menu item under "Log"->"View"->"Next DC" to show the next dive
computer.

Realistically, if you actually commonly use this, you'd use the
accelerator shortcut.  Which right now is Ctrl-C ("C for Computer"),
which is probably a horrible choice.

I really would want to have nice "next/prev dive" accelerators too,
because the cursor keys don't work very well with the gtk focus issues.
Being able to switch between dives would also make the "just the dive
profile, maam" view (ctrl-2) much more useful.

The prev/next dive in the profile view should probably be done with a
keyboard action callback, which also avoids some of the limitations of
accelerators (ie you can make any key do the action).  Some gtk person,
please?

Anyway, this commit only does the dive computer choice thing, and only
using the accelerators.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-17 08:29:39 -10:00
Lubomir I. Ivanov
5c65ed2390 Clear associated tooltip texts when calling expose_event()
In gtk-gui.c:expose_event(), right before clearing the list of tooltips,
we also want to free memory for the associated texts for each one of them.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-16 15:57:25 -10:00
Lubomir I. Ivanov
5c58e1f868 Fixed some memory leaks related to subsurface_get_conf()
In gtk-gui.c:init() we retrieve the configuration values
for PO2, PN2, PHE thresholds but have to also free the values
once done parsing with sscanf().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-16 15:57:11 -10:00
Lubomir I. Ivanov
28cc67c9a1 Fixed a couple of memory leaks related to the download dialog
In render_dc_vendor() and render_dc_product(), there is
no need to allocate memory for the texts that are about to
be added in the combo box trees. Most GTK widgets seem to make
copies of the passed text to them, using g_strdup() and
automatically release said memory when a widget is destroyed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-16 15:56:58 -10:00
Lubomir I. Ivanov
92c15238b6 Make sure that the user entered nickname is never truncated
If the sizes of the two char buffers in set_dc_nickname() (nickname)
and remember_dc() (buffer) are at least twice the size of the allowed
maximum number of characters (sizeof(gunichar) = 2) set by
gtk_entry_set_max_length() for the user nickname,
no truncation will accur then calling snprintf() and cleanedup_nickname()
on said buffers.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-16 07:45:08 -10:00
Lubomir I. Ivanov
be9d924cf8 Reserve enough memory when storing a DC's nickname
in gtk-gui.c:
The input text field in set_dc_nickname() has a limit of 68 unicode
characters, which are 136 bytes. In remember_dc(), to make sure
that this nickname, the deviceid (4 bytes) and also the extra
characters (",{}") always fit wihout truncation (from snprintf) in the
allocated stack buffer, we increase the size of the buffer to 256 bytes.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-15 19:53:07 -10:00
Dirk Hohndel
371ace39b5 Fix possible crash in nickname code
Silly typo, but this is the better solution, anyway.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>`
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-14 07:34:14 -10:00
Dirk Hohndel
713a4fcff6 Add the ability to set a nickname for a dive computer
We maintain a list of dive computers that we know about (by deviceid) and
their nicknames in our config. If the user downloads dive from a dive
computer that we haven't seen before, we give them the option to set a
nickname for that dive computer. That nickname is displayed in the profile
(and stored in the XML file, assuming it is not the same as the model).

This implementation attempts to make sure that it correctly deals with
utf8 nicknames.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-13 21:33:30 -10:00
Dirk Hohndel
aba65736eb Change the empty product model to be index 0
A vendor of -1 indicates that we should have no product selection in the
dive download dialog. Having the empty product model be the last made it
hard to keep the correct index for that empty model around (and we got it
wrong by default).

With this change the product models are offset by one, so the unset vendor
(-1) turns into index 0 which is where we now store the empty model.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-12 07:25:28 -08:00
Dirk Hohndel
597a3677e9 Ensure default dive computer strings can be freed
We don't want to directly use the strings returned to us from
libdivecomputer.

Fixes bug 34

Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-12 07:24:07 -08:00
Dirk Hohndel
91577f11b5 Merge branch 'cns' into cns-merge
I foolishly changed visible_columns in both the (ill-named) cns branch and
master...

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

Conflicts:
	divelist.c
	gtk-gui.c
	profile.c
2012-12-11 13:09:48 -08:00