mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
[Divesite] Add country on divesite
Add more information for the divesite, a country can be used to help sorting. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
aca8fea2a9
commit
cabf8c0c21
2 changed files with 8 additions and 0 deletions
|
@ -205,6 +205,7 @@ uint32_t create_dive_site(const char *name, timestamp_t divetime)
|
||||||
uint32_t uuid = create_divesite_uuid(name, divetime);
|
uint32_t uuid = create_divesite_uuid(name, divetime);
|
||||||
struct dive_site *ds = alloc_or_get_dive_site(uuid);
|
struct dive_site *ds = alloc_or_get_dive_site(uuid);
|
||||||
ds->name = copy_string(name);
|
ds->name = copy_string(name);
|
||||||
|
ds->country = NULL;
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +240,7 @@ bool dive_site_is_empty(struct dive_site *ds)
|
||||||
return same_string(ds->name, "") &&
|
return same_string(ds->name, "") &&
|
||||||
same_string(ds->description, "") &&
|
same_string(ds->description, "") &&
|
||||||
same_string(ds->notes, "") &&
|
same_string(ds->notes, "") &&
|
||||||
|
same_string(ds->country, "") &&
|
||||||
ds->latitude.udeg == 0 &&
|
ds->latitude.udeg == 0 &&
|
||||||
ds->longitude.udeg == 0;
|
ds->longitude.udeg == 0;
|
||||||
}
|
}
|
||||||
|
@ -247,6 +249,7 @@ void copy_dive_site(struct dive_site *orig, struct dive_site *copy)
|
||||||
{
|
{
|
||||||
free(copy->name);
|
free(copy->name);
|
||||||
free(copy->notes);
|
free(copy->notes);
|
||||||
|
free(copy->country);
|
||||||
free(copy->description);
|
free(copy->description);
|
||||||
|
|
||||||
copy->latitude = orig->latitude;
|
copy->latitude = orig->latitude;
|
||||||
|
@ -254,6 +257,7 @@ void copy_dive_site(struct dive_site *orig, struct dive_site *copy)
|
||||||
copy->name = copy_string(orig->name);
|
copy->name = copy_string(orig->name);
|
||||||
copy->notes = copy_string(orig->notes);
|
copy->notes = copy_string(orig->notes);
|
||||||
copy->description = copy_string(orig->description);
|
copy->description = copy_string(orig->description);
|
||||||
|
copy->country = copy_string(orig->country);
|
||||||
copy->uuid = orig->uuid;
|
copy->uuid = orig->uuid;
|
||||||
if (orig->taxonomy.category == NULL) {
|
if (orig->taxonomy.category == NULL) {
|
||||||
free_taxonomy(©->taxonomy);
|
free_taxonomy(©->taxonomy);
|
||||||
|
@ -298,6 +302,7 @@ void merge_dive_site(struct dive_site *a, struct dive_site *b)
|
||||||
merge_string(&a->name, &b->name);
|
merge_string(&a->name, &b->name);
|
||||||
merge_string(&a->notes, &b->notes);
|
merge_string(&a->notes, &b->notes);
|
||||||
merge_string(&a->description, &b->description);
|
merge_string(&a->description, &b->description);
|
||||||
|
merge_string(&a->country, &b->country);
|
||||||
|
|
||||||
if (!a->taxonomy.category) {
|
if (!a->taxonomy.category) {
|
||||||
a->taxonomy = b->taxonomy;
|
a->taxonomy = b->taxonomy;
|
||||||
|
@ -310,6 +315,7 @@ void clear_dive_site(struct dive_site *ds)
|
||||||
free(ds->name);
|
free(ds->name);
|
||||||
free(ds->notes);
|
free(ds->notes);
|
||||||
free(ds->description);
|
free(ds->description);
|
||||||
|
free(ds->name);
|
||||||
ds->name = 0;
|
ds->name = 0;
|
||||||
ds->notes = 0;
|
ds->notes = 0;
|
||||||
ds->description = 0;
|
ds->description = 0;
|
||||||
|
@ -317,6 +323,7 @@ void clear_dive_site(struct dive_site *ds)
|
||||||
ds->longitude.udeg = 0;
|
ds->longitude.udeg = 0;
|
||||||
ds->uuid = 0;
|
ds->uuid = 0;
|
||||||
ds->taxonomy.nr = 0;
|
ds->taxonomy.nr = 0;
|
||||||
|
ds->country = 0;
|
||||||
free_taxonomy(&ds->taxonomy);
|
free_taxonomy(&ds->taxonomy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ struct dive_site
|
||||||
{
|
{
|
||||||
uint32_t uuid;
|
uint32_t uuid;
|
||||||
char *name;
|
char *name;
|
||||||
|
char *country;
|
||||||
degrees_t latitude, longitude;
|
degrees_t latitude, longitude;
|
||||||
char *description;
|
char *description;
|
||||||
char *notes;
|
char *notes;
|
||||||
|
|
Loading…
Add table
Reference in a new issue