Move resetting of current file out of clear_dive_file_data()

This is the only case where C-code sets the current file.
Remove this call for a better separation of C-backend and
C++-frontend parts.

There were four callers of clear_dive_file_data(). Two of them
would call set_filename() anyway. For the remaining two add an
explicit call to set_filename().

This commit fixes a bug introduced in commit b3901aa8f9:
The cloud-online menu entry was still enabled after "closing" the
cloud storage.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-12-11 23:20:18 +01:00 committed by Jan Mulder
parent 35b5b9282f
commit 099662023c
3 changed files with 2 additions and 3 deletions

View file

@ -1426,9 +1426,6 @@ void clear_dive_file_data()
clear_dive(&displayed_dive);
clear_dive_site(&displayed_dive_site);
free((void *)existing_filename);
existing_filename = NULL;
reset_min_datafile_version();
saved_git_id = "";
}

View file

@ -746,6 +746,7 @@ void MainWindow::closeCurrentFile()
/* free the dives and trips */
clear_git_id();
clear_dive_file_data();
setCurrentFile(NULL);
cleanUpEmpty();
mark_divelist_changed(false);

View file

@ -602,6 +602,7 @@ void QMLManager::loadDivesWithValidCredentials()
appendTextToLog(errorString);
setNotificationText(errorString);
revertToNoCloudIfNeeded();
set_filename(NULL);
return;
}
consumeFinishedLoad(currentDiveTimestamp);