summaryrefslogtreecommitdiffstats
path: root/save-xml.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-09 13:06:30 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-09 13:06:30 -0700
commit9e4f9fad19bd4696bf08da67b60ed9d2eb29b446 (patch)
tree762d87bb965705c6d51b89c6abf594e6c5b6bba5 /save-xml.c
parented3f67bc33fbd9aac819687317d3066c22799f83 (diff)
downloadsubsurface-9e4f9fad19bd4696bf08da67b60ed9d2eb29b446.tar.gz
Store the tag names instead of an opaque number
And as we need the names for that, simplify the way we show the tags in the Dive Info tab (and mark them for translation while we are at it). In the process I renamed the constants to DTAG_ from DTYPE_ (and made their nature as being just bits more obvious). Also mark the box on the Info tab "Dive Tags", not "Dive Type". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r--save-xml.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/save-xml.c b/save-xml.c
index d7ac878c5..233482969 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -391,6 +391,22 @@ static void save_events(FILE *f, struct event *ev)
}
}
+static void save_tags(FILE *f, int tags)
+{
+ int i, more = 0;
+
+ fprintf(f, " tags='");
+ for (i = 0; i < DTAG_NR; i++) {
+ if (tags & (1 << i)) {
+ if (more)
+ fprintf(f, ", ");
+ fprintf(f, "%s", dtag_names[i]);
+ more = 1;
+ }
+ }
+ fprintf(f, "'");
+}
+
static void show_date(FILE *f, timestamp_t when)
{
struct tm tm;
@@ -452,7 +468,8 @@ void save_dive(FILE *f, struct dive *dive)
if (dive->visibility)
fprintf(f, " visibility='%d'", dive->visibility);
if (dive->dive_tags)
- fprintf(f, " tags='%d'", dive->dive_tags);
+ save_tags(f, dive->dive_tags);
+
show_date(f, dive->when);
fprintf(f, " duration='%u:%02u min'>\n",
FRACTION(dive->dc.duration.seconds, 60));