mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site rewrite: copy the current dive to the displayed dive
This way we can actually edit something. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
09f2d3b35d
commit
2fec1a88de
3 changed files with 15 additions and 0 deletions
13
divesite.c
13
divesite.c
|
@ -156,3 +156,16 @@ bool dive_site_is_empty(struct dive_site *ds)
|
||||||
ds->latitude.udeg == 0 &&
|
ds->latitude.udeg == 0 &&
|
||||||
ds->longitude.udeg == 0;
|
ds->longitude.udeg == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void copy_dive_site(struct dive_site *orig, struct dive_site *copy)
|
||||||
|
{
|
||||||
|
free(copy->name);
|
||||||
|
free(copy->notes);
|
||||||
|
free(copy->description);
|
||||||
|
|
||||||
|
copy->latitude = orig->latitude;
|
||||||
|
copy->longitude = orig->longitude;
|
||||||
|
copy->name = copy_string(orig->name);
|
||||||
|
copy->notes = copy_string(orig->notes);
|
||||||
|
copy->description = copy_string(orig->description);
|
||||||
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ uint32_t get_dive_site_uuid_by_name(const char *name, struct dive_site **dsp);
|
||||||
uint32_t get_dive_site_uuid_by_gps(degrees_t latitude, degrees_t longitude, struct dive_site **dsp);
|
uint32_t get_dive_site_uuid_by_gps(degrees_t latitude, degrees_t longitude, struct dive_site **dsp);
|
||||||
uint32_t get_dive_site_uuid_by_gps_proximity(degrees_t latitude, degrees_t longitude, int distance, struct dive_site **dsp);
|
uint32_t get_dive_site_uuid_by_gps_proximity(degrees_t latitude, degrees_t longitude, int distance, struct dive_site **dsp);
|
||||||
bool dive_site_is_empty(struct dive_site *ds);
|
bool dive_site_is_empty(struct dive_site *ds);
|
||||||
|
void copy_dive_site(struct dive_site *orig, struct dive_site *copy);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -703,6 +703,7 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
ui.locationTags->hide();
|
ui.locationTags->hide();
|
||||||
else
|
else
|
||||||
ui.locationTags->show();
|
ui.locationTags->show();
|
||||||
|
copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* clear the fields */
|
/* clear the fields */
|
||||||
|
|
Loading…
Add table
Reference in a new issue