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>
This commit is contained in:
Dirk Hohndel 2013-01-06 22:09:12 -08:00
parent fb99c9a163
commit be9be189f7
5 changed files with 203 additions and 18 deletions

View file

@ -1304,6 +1304,30 @@ static void clear_trip_indexes(void)
trip->index = 0;
}
void select_last_dive(void)
{
GtkTreeSelection *selection;
GtkTreeIter iter;
struct dive *dive;
int i;
/* select the last dive (and make sure it's an actual dive that is selected) */
/* WARNING - this only works when sorted by date!!!
*
*
*
*/
gtk_tree_model_get_iter_first(MODEL(dive_list), &iter);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dive_list.tree_view));
gtk_tree_selection_unselect_all(selection);
for_each_dive(i, dive)
dive->selected = FALSE;
amount_selected = 0;
gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &selected_dive, -1);
first_leaf(MODEL(dive_list), &iter, &selected_dive);
gtk_tree_selection_select_iter(selection, &iter);
}
static void fill_dive_list(void)
{
int i, trip_index = 0;