]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikwaypoint.c
Support GPX 'type' field on Waypoints, Tracks and Routes.
[andy/viking.git] / src / vikwaypoint.c
index 21d63deb366679707ef5731fad110d52e2e5628a..fad5589f3d9f6d3c83764bdd5d08839f7dd69985 100644 (file)
@@ -75,6 +75,28 @@ void vik_waypoint_set_description(VikWaypoint *wp, const gchar *description)
     wp->description = NULL;
 }
 
+void vik_waypoint_set_source(VikWaypoint *wp, const gchar *source)
+{
+  if ( wp->source )
+    g_free ( wp->source );
+
+  if ( source && source[0] != '\0' )
+    wp->source = g_strdup(source);
+  else
+    wp->source = NULL;
+}
+
+void vik_waypoint_set_type(VikWaypoint *wp, const gchar *type)
+{
+  if ( wp->type )
+    g_free ( wp->type );
+
+  if ( type && type[0] != '\0' )
+    wp->type = g_strdup(type);
+  else
+    wp->type = NULL;
+}
+
 void vik_waypoint_set_url(VikWaypoint *wp, const gchar *url)
 {
   if ( wp->url )
@@ -126,6 +148,10 @@ void vik_waypoint_free(VikWaypoint *wp)
     g_free ( wp->comment );
   if ( wp->description )
     g_free ( wp->description );
+  if ( wp->source )
+    g_free ( wp->source );
+  if ( wp->type )
+    g_free ( wp->type );
   if ( wp->url )
     g_free ( wp->url );
   if ( wp->image )
@@ -146,6 +172,8 @@ VikWaypoint *vik_waypoint_copy(const VikWaypoint *wp)
   vik_waypoint_set_name(new_wp,wp->name);
   vik_waypoint_set_comment(new_wp,wp->comment);
   vik_waypoint_set_description(new_wp,wp->description);
+  vik_waypoint_set_source(new_wp,wp->source);
+  vik_waypoint_set_type(new_wp,wp->type);
   vik_waypoint_set_url(new_wp,wp->url);
   vik_waypoint_set_image(new_wp,wp->image);
   vik_waypoint_set_symbol(new_wp,wp->symbol);
@@ -196,6 +224,8 @@ void vik_waypoint_marshall ( VikWaypoint *wp, guint8 **data, guint *datalen)
   vwm_append(wp->name);
   vwm_append(wp->comment);
   vwm_append(wp->description);
+  vwm_append(wp->source);
+  vwm_append(wp->type);
   vwm_append(wp->url);
   vwm_append(wp->image);
   vwm_append(wp->symbol);
@@ -231,6 +261,8 @@ VikWaypoint *vik_waypoint_unmarshall (guint8 *data, guint datalen)
   vwu_get(new_wp->name);
   vwu_get(new_wp->comment);
   vwu_get(new_wp->description);
+  vwu_get(new_wp->source);
+  vwu_get(new_wp->type);
   vwu_get(new_wp->url);
   vwu_get(new_wp->image); 
   vwu_get(new_wp->symbol);