summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-03 14:26:27 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 16:38:36 -0700
commit58f2613daeabeb3f7470d4e26af7a7ad75624d5e (patch)
tree1336b4aef1eb7f7bd6d371e713eb94bda69dcdce
parent33223fb2cca9b0b5e104f8a121b5cc5f48996238 (diff)
downloadsubsurface-58f2613daeabeb3f7470d4e26af7a7ad75624d5e.tar.gz
Add photo saving for the XML backend.
This code correctly saves the added pictures on the xml backend. next: git backend. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--save-xml.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/save-xml.c b/save-xml.c
index e52cfdffd..5f61af77f 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -369,6 +369,18 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer
put_format(b, " </divecomputer>\n");
}
+static void save_picture(struct membuffer *b, struct picture *pic)
+{
+ put_string(b, " <picture filename='");
+ put_string(b, pic->filename);
+ put_string(b, "'");
+ if (pic->latitude.udeg || pic->longitude.udeg) {
+ put_degrees(b, pic->latitude, " gps='", " ");
+ put_degrees(b, pic->longitude, "", "'");
+ }
+ put_string(b, "/>\n");
+}
+
void save_one_dive(struct membuffer *b, struct dive *dive)
{
struct divecomputer *dc;
@@ -394,6 +406,8 @@ void save_one_dive(struct membuffer *b, struct dive *dive)
/* Save the dive computer data */
for_each_dc(dive, dc)
save_dc(b, dive, dc);
+ FOR_EACH_PICTURE(dive)
+ save_picture(b, picture);
put_format(b, "</dive>\n");
}