[Divesite] Load / Save divesite country on git

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2017-10-02 17:24:26 +02:00 committed by Dirk Hohndel
parent 32e6ca4919
commit f9a36132ad
2 changed files with 5 additions and 1 deletions

View file

@ -293,6 +293,9 @@ static void parse_dive_notrip(char *line, struct membuffer *str, void *_dive)
struct dive *dive = _dive; dive->tripflag = NO_TRIP;
}
static void parse_site_country(char *line, struct membuffer *str, void *_ds)
{ (void) line; struct dive_site *ds = _ds; ds->country = strdup(mb_cstring(str)); }
static void parse_site_description(char *line, struct membuffer *str, void *_ds)
{ (void) line; struct dive_site *ds = _ds; ds->description = strdup(mb_cstring(str)); }
@ -994,7 +997,7 @@ static void dive_parser(char *line, struct membuffer *str, void *_dive)
struct keyword_action site_action[] = {
#undef D
#define D(x) { #x, parse_site_ ## x }
D(description), D(geo), D(gps), D(name), D(notes)
D(country), D(description), D(geo), D(gps), D(name), D(notes)
};
static void site_parser(char *line, struct membuffer *str, void *_ds)

View file

@ -961,6 +961,7 @@ static void save_divesites(git_repository *repo, struct dir *tree)
}
struct membuffer site_file_name = { 0 };
put_format(&site_file_name, "Site-%08x", ds->uuid);
show_utf8(&b, "country ", ds->country, "\n");
show_utf8(&b, "name ", ds->name, "\n");
show_utf8(&b, "description ", ds->description, "\n");
show_utf8(&b, "notes ", ds->notes, "\n");