QML UI: make sure the dive list is empty before loading dives

When testing subsurface-mobile on the desktop from an account that had a
default file set up in the Subsurface preferences that file would already
be loaded creating rather confusing output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-07-24 13:18:30 -07:00
parent 7e7dcb2451
commit a05e37188b
4 changed files with 20 additions and 13 deletions

View file

@ -1098,3 +1098,16 @@ void report_datafile_version(int version)
if (min_datafile_version == 0 || min_datafile_version > version)
min_datafile_version = version;
}
void clear_dive_file_data()
{
while (dive_table.nr)
delete_single_dive(0);
while (dive_site_table.nr)
delete_dive_site(get_dive_site(0)->uuid);
free((void *)existing_filename);
existing_filename = NULL;
reset_min_datafile_version();
}