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>
This commit is contained in:
Dirk Hohndel 2012-12-21 20:00:20 -08:00
parent eb3e879030
commit 8d2abc05f6
6 changed files with 21 additions and 26 deletions

14
main.c
View file

@ -124,15 +124,11 @@ void report_dives(gboolean is_imported, gboolean prefer_imported)
int preexisting = dive_table.preexisting;
struct dive *last;
/* set the nickname for the divecomputer for newly downloaded dives */
for (i = dive_table.preexisting; i < dive_table.nr; i++)
if (dive_table.dives[i]->downloaded) {
set_dc_nickname(dive_table.dives[i]);
} else {
struct divecomputer *dc = &dive_table.dives[i]->dc;
if (dc->nickname && *dc->nickname)
remember_dc(dc->deviceid, dc->nickname, TRUE);
}
/* check if we need a nickname for the divecomputer for newly downloaded dives;
* since we know they all came from the same divecomputer we just check for the
* first one */
if (preexisting < dive_table.nr && dive_table.dives[preexisting]->downloaded)
set_dc_nickname(dive_table.dives[preexisting]);
/* This does the right thing for -1: NULL */
last = get_dive(preexisting-1);