Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Feb 10, 2013
  1. @dirkhh

    Fix saving of changed GPS entry

    authored dirkhh committed
    We can't use gps_changed() in the gps_map_callback function, because that
    will actually change the GPS data in the dive being edited, which in turn
    will then cause us to later (when we *really* want to change it) not match
    the master dive data any more, and think we shouldn't edit the dive at
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
  2. @dirkhh

    Fix rounding of GPS coordinates

    authored dirkhh committed
    The whole "+ 0.5" to round to integers only works for positive values,
    and GPS coordinates are signed.
    So use the proper "round to int" function (rint()), which does this correctly.
    Also, remove the redundant check against the master gps values: we
    already checked that if we do have a master dive, the gps values must
    match the currently edited dive, so comparing against the master is
    entirely redundant.
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
Commits on Feb 9, 2013
  1. @dirkhh

    Walk over each divecomputer entry in fixup_dives()

    authored dirkhh committed
    The fixup_dives() code used to only look at the first divecomputer,
    which meant that minimun temperatures etc for the dive would only ever
    come from the primary divecomputer.
    This splits up the code that walks over the divecomputer into a function
    of its own, and iterates over all computers in fixup_dive() calling into
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
Commits on Feb 3, 2013
  1. @dirkhh

    Fix air temperature for multi-dive editing

    authored dirkhh committed
    The air temperature editing was broken when you edited multiple dives at
    once: even if you didn't actually change the air temperature, all dives
    would be reset to that particular temperature.
    The logic for editing dives is that we have a 'master' dive (which is
    the dive that all the entries get filled in from), and only if the
    entries have changed from what the master dive information was (ie the
    user actually edited it) do we change that particular piece of
    And we only change it for dives that match the master dive for that
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
  2. @dirkhh

    Add default GPS location for dive sites we already know about

    authored dirkhh committed
    When editing a new dive, and using a dive site name that we have
    already seen previously, and have GPS information for, pick up that
    GPS information from the previous dive by default.
    NOTE! When editing dive site locations for dives that already have GPS
    information, or when we've modified the GPS information explicitly
    some way while editing the dive (either through map input or by
    editing the text field directly) we do *not* use this automatic logic.
    So if you messed up the GPS information some way and want to
    re-populate it with the automatic mode, you need to explicitly clear
    the GPS text-field, at which point we go back to "ok, let's try to
    pick up automatic GPS data from previous dives with the same name"
    Also note that we do the automatic location lookup only when actually
    editing the location field. So if you already wrote the dive site
    name, then cleared the GPS field, you now need to go back to the dive
    site name and edit it again to get the automatic GPS filling.
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
Commits on Jan 28, 2013
  1. @dirkhh

    Clean up gtk combo box handling

    authored dirkhh committed
    This cleans up our handling of combo boxes and all the duplicated
    completion logic, and simplifies the code.
    In particular, we get rid of the deprecated GtkComboBoxEntry.  While it
    made some things easier, it made other things harder.  Just using
    GtkComboBox and setting that up correctly ends up being simpler, and
    also makes the logic work with gtk-3.
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
Commits on Jan 23, 2013
  1. @dirkhh

    Move more dive computer filled data to the divecomputer structure

    authored dirkhh committed
    This moves the fields 'duration', 'surfacetime', 'maxdepth',
    'meandepth', 'airtemp', 'watertemp', 'salinity' and 'surface_pressure'
    to the per-divecomputer data structure.  They are filled in by the dive
    computer, and normally not edited.
    NOTE! All actual *use* of this data was then changed from dive->field to
    dive->dc.field programmatically with a shell-script and sed, and the
    result then edited for details.  So while the XML save and restore code
    has been updated, all the displaying etc will currently always just show
    the first dive computer entry.
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
Commits on Jan 11, 2013
  1. @dirkhh

    Split up preference data structure definition into 'pref.h'

    authored dirkhh committed
    .. and rename the badly named 'output_units/input_units' variables.
    We used to have this confusing thing where we had two different units
    (input vs output) that *look* like they are mirror images, but in fact
    "output_units" was the user units, and "input_units" are the XML parsing
    So this renames them to be clearer.  "output_units" is now just "units"
    (it's the units a user would ever see), and "input_units" is now
    "xml_parsing_units" and set by the XML file parsers to reflect the units
    of the parsed file.
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Dirk Hohndel <>
Commits on Sep 24, 2012
  1. Update cylinder info properly

    The "cylinders_equal()/copy_cylinders()" functions were buggered, and
    only checked (and copied) the cylinder type.  That was on purpose, since
    you do want to be able to change the type of a cylinder without changing
    the gasmix of the cylinder.
    HOWEVER, the reverse is also true: you may want to change the gasmix of
    a cylinder without changing the type.
    So it's not that the type of the cylinder is special - it's that the
    type and the gasmix should be considered separately.
    Do that properly for the equipment editing case.
    Reported-by: Ďoďo <>
    Signed-off-by: Linus Torvalds <>
Commits on Sep 20, 2012
  1. Merge branch 'divetrip-rewrite' of git://

    Merge the dive trip rewrite by Dirk Hohndel.
    This just merges the dive trip changes with the timestamp handling
    changes.  There were multiple small data conflicts, along with some
    newly added 'time_t' cases in the dive trip handling that needed to be
    converted to 'timestamp_t' along the way.
    * 'divetrip-rewrite' of git://
      Convert FIND_TRIP into function
      Partial rewrite of the dive trip code
      Check if trip is NULL before calling DIVE_TRIP
  2. dive-time widget: fix incorrect use of timestamp_t

    I did a global search-and-replace to make all "time_t" users use the
    internal subsurface 64-bit "timestamp_t" type instead, but we have one
    case that still uses the system time functions: the use of "localtime()"
    in the dive_time_widget().
    Everywhere else we always just use UTC for all our time handling, and we
    don't really ever care about the local timezone etc.  However, for the
    dive time widget, we initialize the calendar widget to the current time,
    which obviously does want to take the local timezone into account, so
    there we end up using the whole system time handling code.
    So that one should continue to use time_t, even if it might have the
    year-2038 problem.  We also don't care about the fact that it's not
    thread-safe, since this is just initializing the widget which definitely
    doesn't happen threaded.
    Signed-off-by: Linus Torvalds <>
  3. Use a 64-bit 'timestamp_t' for all timestamps, rather than 'time_t'

    This makes the time type unambiguous, and we can use G_TYPE_INT64 for it
    in the divelist too.
    It also implements a portable (and thread-safe) "utc_mkdate()" function
    that acts kind of like gmtime_r(), but using the 64-bit timestamp_t.  It
    matches our original "utc_mktime()".
    Signed-off-by: Linus Torvalds <>
Commits on Aug 28, 2012
  1. Merge git://

    Pull a few buglet fixes from Mikko Rasa.
    Some trivial conflicts due to changes in the dive selection logic, and
    using the new "for_each_dive()" helper.
    * git://
      Check if multi-dive editing is actually needed
      Fix an off-by-one error in buffer allocation
Commits on Aug 26, 2012
  1. Do some whitespace cleanup

    The previous commit was a patch from Lubomir, which also had some
    whitespace fixes (to go with some new whitespace bugs to replace them)
    in it.
    I removed the whitespace changes from that patch (don't mix whitespace
    fixes with other fixes, unless they are on the same lines!) but decided
    to look for other whitespace issues, and this is the result.
    I left the non-C files alone, some of the spec and script files also
    have whitespace at the end of lines etc.
    Signed-off-by: Linus Torvalds <>
Commits on Aug 21, 2012
  1. Add helper 'for_each_dive()' dive iterator

    It's an easy thing to do, but the for-loop ends up being pretty ugly, so
    hide it behind the macro.
    It would be even prettier with one of the (few) useful C99 features:
    local for-loop variables.  However, gcc needs special command line
    options, and other compilers may not do it at all. So instead of doing
       #define for_each_dive(_x) \
          for (int _i = 0; ((_x) = get_dive(_i)) != NULL; _i++)
    we require that the user declare the index iterator too, and the use
    syntax becomes
       for_each_dive(idx, dive) {
    	... use idx/dive here ...
    And hey, maybe somebody actually will want to use the index, so maybe
    that's not all bad.
    Signed-off-by: Linus Torvalds <>
  2. Fix single-dive editing oddity

    The multi-dive case does fine, but the single-dive case (used when
    adding a dive, for example) was somewhat confused between the dive index
    (which is the location in the dive array) and the dive number.
    Fix this by just passing the dive pointer instead (where NULL means to
    use the current dive selection).
    Reported-by: Jacco van Koll <>
    Root-caused-by: Dirk Hohndel <>
    Signed-off-by: Linus Torvalds <>
Commits on Aug 20, 2012
  1. Rework dive selection logic

    This completely changes how we keep track of selected dives: instead of
    having an array listing the selection ("selectiontracker") or trusting
    the gtk selection information, just save the information about whether a
    dive is selected in the dive itself.
    That makes it trivial to keep track of the state of selection across
    group collapse/expand events, or when changing the tree view model.  It
    also ends up simplifying the code and logic in other ways.
    HOWEVER, it does currently (re-)introduce an annoying oddity with gtk:
    if you collapse a dive trip that has individual selections, gtk will
    forget those selections ("out of sight, out of mind"), and when you do
    *new* selections, the old hidden ones remain.
    So there's some games required to make gtk do sane things.  We may need
    to either explicitly drop selections when collapsing trips, or make sure
    the group entry gets selected when collapsing a group that has
    selections in it. Or something.
    There may be other issues introduced by this too.
    Signed-off-by: Linus Torvalds <>
Commits on Aug 18, 2012
  1. Select better (?) default date for adding new dive

    We now pick one hour after the end of the currently selected dive as the
    default starting time for the new dive to be added.  If multiple dives
    (or no dives) are selected, we default to current time as before.
    The "one hour after the end" is just a random (but not unreasonable)
    assumption for the surface time if you add multiple dives.
    Suggested-by: Miika Turkia <>
    Signed-off-by: Linus Torvalds <>
Commits on Aug 17, 2012
  1. Merge branch 'misc-fixes' of git://

    Pull miscellaneous fixes, mostly UI stuff from Mikko Rasa.
    Both this and the pull from Pierre-Yves Chibon created a "Save As" menu
    entry and logic.  As a result, there were a fair number of conflicts,
    but I tried to make the end result somewhat reasonable.  I might have
    missed some semantic conflict, though.
    Series-acked-by: Henrik Brautaset Aronsen <>
    * 'misc-fixes' of git://
      Add a separate "Save as" entry to the menu
      Changes to menu icons
      Improved depth info for dives without samples
      Divide the panes evenly in view_three
  2. multi-dive editing: don't change fields that weren't changed for the …

    …master dive
    Commit 2f773b9 ("multi-dive editing: don't change already set data
    for other dives") didn't get the multi-dive editing quite right: even if
    one of the dives in the list of changed dives has an empty field, we
    should *not* fill it with the edit data unless that edit data was
    actually changed.
    So compare the new data with the original master data, and if they
    match, do nothing.
    Signed-off-by: Linus Torvalds <>
  3. multi-dive editing: don't change already set data for other dives

    When editing multiple dives at the same time, don't change fields that
    have already been set for a dive, unless the old field contents match
    the currently selected ("master") dive.
    So when you edit multiple dives, you can set the dive master or buddy
    (or suit etc) for all of them in one go, but if one of them already has
    that field set, it won't be modified just because you set the other
    Acked-by: Dirk Hohndel <>
    Signed-off-by: Linus Torvalds <>
Commits on Aug 16, 2012
  1. Avoid SIGSEGV when editing multiple dives

    The multi-dive editing is broken if you right-click on the dive
    text-fields (instead of the divelist).  This just avoids the SIGSEGV, it
    doesn't really fix the editing.
    Signed-off-by: Linus Torvalds <>
  2. Merge branch 'tree2' of git://

    Pull dive-trip grouping from Dirk Hohndel:
     "This turned into an updated pull request for the tree2 branch where I
      implemented the date based grouping - but is actually a very different
      topic: this adds the ability to edit multiple dives (and fixes some
      issues with the dive editing overall).  The reason for that is that it
      reuses some of the infrastructure that I implemented in the tree2
      branch for tracking the selected dives.  More details in the commit
    * 'tree2' of git://
      Switch from date based to dive trip based grouping
      Redo dive editing
      Fix selecting and unselecting summary items
      Apply sort functions to the correct model, don't select summary entries
      Maintain selected rows when switching between list model and tree model
      Create duplicate list model so sorting by columns works again
      Improve tree model implementation
      Allow date based grouping
  3. Merge branch 'suit' of git://

    Pull exposure suit tracking from Dirk Hohndel.
    * 'suit' of git://
      Add exposure protection tracking
Commits on Jun 28, 2012
  1. Make the 'Add Dive' dialog at least slightly less butt-ugly

    I still suspect that using spinbuttons for the time handling is the
    wrong way, and I'm a bit surprised the Calendar widget doesn't have a
    mode where you can see/set the time too.
    But this makes things at least minimally prettier, and initializes the
    time entries to the current time (which is obviously not what anybody
    really wants, but looks a lot better than defaulting to "midnight" or
    some other random time that *also* won't be what anybody actually
    I think this might be something we can live with, although I hope
    somebody with good taste comes along and say "don't use spinbuttons, do
    this: xyzzy" and makes things look better yet.
    Also, I have this suspicion that I should put the time/depth/duration
    stuff to the right of the calendar.  Most displays are wider than they
    are tall, so tall and skinny dialogs are bad especially if you have
    limited vertical pixels.  I still have flashbacks to my netbook-using
    days, hating applictions that did that.
    Signed-off-by: Linus Torvalds <>
Commits on Jun 27, 2012
  1. Add depth entry to new dive edit dialog

    Christ, if you look up "Ugly dialog" on Wikipedia, I think it has a
    picture of this "New dive" thing.  Or it should have.
    But it kind of works.  Although with only a "max depth" entry, you can't
    currently set average depths etc, so SAC-rates etc cannot be calculated
    for these kinds of dives.
    And the dive numbering is wrong.  We do auto-number new dives that get
    added at the end, but we do it as we add them, so when you *edit* the
    dive information (before it has been added) the dive number shows up as
    So there's certainly room for improvement here.
    Signed-off-by: Linus Torvalds <>
  2. Rough "Add new dive" infrastructure in the divelist

    Do a right-click to get a menu with the "Add dive" entry.  Should do
    delete too, but that's for later.
    What's also apparently for later is to make this *useful*.  It's the
    butt-ugliest time entry field ever, and there's no way to set depth for
    the dive either.  So this is more of a RFC than anything truly useful.
    Signed-off-by: Linus Torvalds <>
Commits on Apr 25, 2012
  1. Make sure to update dive info when it is edited

    We used to not properly update the dive info until we switched to
    another dive when we edited it.  This should fix it.
    Signed-off-by: Linus Torvalds <>
Commits on Apr 3, 2012
  1. Add the ugliest 'delete dive' model ever

    This interface works the same way the "edit dive" menu item does: it's a
    text entry meny item on the dive text entries (ie buddy/divemaster/notes
    sections).  Except you pick the "Delete" entry rather than the "Edit"
    It kind of works, but it really is a pretty horrible interface.  I'll
    need to add a top-level dive menu entry for just deleting all selected
    dives instead.  And it would be good to be able to get a drop-down menu
    from the divelist instead of having to do it from the dive text entries,
    which is just insane.
    But that requires gtk work.  I'm not quite ready to get back into that.
    Thus the "exact same insane interface as the explicit 'Edit' mode".
    Signed-off-by: Linus Torvalds <>
Commits on Dec 12, 2011
  1. Pack the star rating on a line of its own

    Packing it next to the divemaster/buddy information may work great on a
    big screen with lots of pixes, but it makes the minimum window size way
    wide for a small screen.  So don't do it.
    Signed-off-by: Linus Torvalds <>
Commits on Dec 11, 2011
  1. Allow editing of Helium values in cylinder info

    Henrik Aronsen points out that we've not made it possible to edit the He
    percentages for trimix diving.  It's easy enough to do, I just didn't
    have any dives that needed it myself.  So here goes.
    Reported-by: Henrik Brautaset Aronsen <>
    Signed-off-by: Linus Torvalds <>
Commits on Nov 19, 2011
  1. Add the cylinder list to the dive info edit dialog

    This way, when you have a new dive that you just imported from your dive
    computer, you can just double-click on the dive and fill out all the
    relevant information: location, notes, buddies and cylinder info.
    Signed-off-by: Linus Torvalds <>
  2. Add dive number and date to the dive info edit dialog

    It's pretty basic information, and might be hidden behind the dialog
    especially on a small screen.
    Signed-off-by: Linus Torvalds <>
  3. Add an 'edit' menu item to the dive info text fields

    It just pops up the dive info edit box.  This way you can be in the dive
    info tab, and not have to go to the dive list just to double-click on
    the dive.
    This thing still needs some polish, but it's now usable.
    Signed-off-by: Linus Torvalds <>
  4. Make double-clicking on the dive list bring up the dive editor

    Now that the dive info window is read-only, we need to edit the dives
    some other way.  We bring up a dive info edit dialog when you
    double-click on the dive list entry for that dive.
    I do want to have an "edit" button or keyboard shortcut or something
    too, though.
    Signed-off-by: Linus Torvalds <>
Something went wrong with that request. Please try again.