From: Kaj-Michael Lang Date: Thu, 12 Jun 2008 14:25:36 +0000 (+0300) Subject: More auto route changes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26e04d1aa312485dc302ebbefc10792237255484;p=mapper More auto route changes --- diff --git a/src/mapper-types.h b/src/mapper-types.h index a0da73c..e590b6f 100644 --- a/src/mapper-types.h +++ b/src/mapper-types.h @@ -89,23 +89,6 @@ typedef enum { } SpeedLocation; gchar *SPEED_LOCATION_TEXT[SPEED_LOCATION_ENUM_COUNT]; -typedef struct _RouteDownloadData RouteDownloadData; -struct _RouteDownloadData { - gchar *bytes; - guint bytes_read; -}; - -/** Data used during the asynchronous automatic route downloading operation. */ -typedef struct _AutoRouteDownloadData AutoRouteDownloadData; -struct _AutoRouteDownloadData { - gboolean enabled; - gboolean in_progress; - gchar *dest; - CURL *curl_easy; - gchar *src_str; - RouteDownloadData rdl_data; -}; - typedef struct _BrowseInfo BrowseInfo; struct _BrowseInfo { GtkWidget *dialog; diff --git a/src/path-mapper.c b/src/path-mapper.c index 0cfb059..112376a 100644 --- a/src/path-mapper.c +++ b/src/path-mapper.c @@ -31,7 +31,7 @@ #include "file.h" #include "latlon.h" #include "path.h" -#include "map-download.h" +#include "path-mapper.h" typedef struct _OriginToggleInfo OriginToggleInfo; struct _OriginToggleInfo { @@ -81,7 +81,7 @@ gdouble dist; if (path && path_has_points(path)) { dist=path_calculate_distance_from(path, point); - g_snprintf(buffer, sizeof(buffer), "%s: %.02f %s", _("Distance"), sum * UNITS_CONVERT[_units], UNITS_TEXT[_units]); + g_snprintf(buffer, sizeof(buffer), "%s: %.02f %s", _("Distance"), dist * UNITS_CONVERT[_units], UNITS_TEXT[_units]); MACRO_BANNER_SHOW_INFO(_window, buffer); } else { MACRO_BANNER_SHOW_INFO(_window, _("The current path is empty.")); @@ -345,12 +345,12 @@ route_auto_download_timeout() CURLMsg *msg; gint num_msgs = 0; -if (!_autoroute.curl_multi) { +if (!_autoroute_data.curl_multi) { route_cancel_autoroute(_route, TRUE); return FALSE; } -while (_autoroute.curl_multi && (msg = curl_multi_info_read(_autoroute.curl_multi, &num_msgs))) { +while (_autoroute_data.curl_multi && (msg = curl_multi_info_read(_autoroute_data.curl_multi, &num_msgs))) { if (msg->msg == CURLMSG_DONE) { /* Now, parse the autoroute and update the display. */ if (_autoroute_data.enabled && path_gpx_parse(_route, _autoroute_data.rdl_data.bytes, _autoroute_data.rdl_data.bytes_read, 0)) { diff --git a/src/path-mapper.h b/src/path-mapper.h index a19760b..5af2969 100644 --- a/src/path-mapper.h +++ b/src/path-mapper.h @@ -8,6 +8,24 @@ Path *_track; +typedef struct _RouteDownloadData RouteDownloadData; +struct _RouteDownloadData { + gchar *bytes; + guint bytes_read; +}; + +/** Data used during the asynchronous automatic route downloading operation. */ +typedef struct _AutoRouteDownloadData AutoRouteDownloadData; +struct _AutoRouteDownloadData { + gboolean enabled; + gboolean in_progress; + gchar *dest; + guint curl_sid; + CURLM *curl_multi; + CURL *curl_easy; + gchar *src_str; + RouteDownloadData rdl_data; +}; /** The singleton auto-route-download data. */ AutoRouteDownloadData _autoroute_data; @@ -22,7 +40,6 @@ gboolean route_show_distance_to(Path *route, Point *point); void route_show_distance_to_last(Path *route); void route_show_distance_to_next(Path *route); - gboolean track_save(Path *track); gboolean track_open(Path *track); void track_clear(Path *track);