From 5ceaef2fa38defc97cc9b083fe2f96f07a77b0ed Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 6 Nov 2007 11:34:23 +0200 Subject: [PATCH] Start to remove usage of global _route, begin with route store generator. --- src/cb.c | 6 +++--- src/route.c | 17 +++++++---------- src/route.h | 3 +++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cb.c b/src/cb.c index 8a78181..d538ec3 100644 --- a/src/cb.c +++ b/src/cb.c @@ -45,9 +45,9 @@ #include "utils.h" #include "poi.h" +#include "path.h" #include "route.h" #include "track.h" -#include "path.h" #include "settings.h" #include "gps.h" #include "map.h" @@ -69,7 +69,7 @@ menu_cb_route_download(GtkAction * action) GtkListStore *store; route_download(NULL); -store=route_generate_store(); +store=route_generate_store(&_route); if (store!=NULL) { gtk_tree_view_set_model(route_tree_view, store); g_object_unref(G_OBJECT(store)); @@ -83,7 +83,7 @@ menu_cb_route_open(GtkAction * action) GtkListStore *store; route_open_file(); -store=route_generate_store(); +store=route_generate_store(&_route); if (store!=NULL) { gtk_tree_view_set_model(route_tree_view, store); g_object_unref(G_OBJECT(store)); diff --git a/src/route.c b/src/route.c index beba259..afb73c0 100644 --- a/src/route.c +++ b/src/route.c @@ -224,12 +224,9 @@ _autoroute_data.src_str = g_free(latlonstr); MACRO_CURL_EASY_INIT(_autoroute_data.curl_easy); -curl_easy_setopt(_autoroute_data.curl_easy, CURLOPT_URL, - _autoroute_data.src_str); -curl_easy_setopt(_autoroute_data.curl_easy, CURLOPT_WRITEFUNCTION, - route_dl_cb_read); -curl_easy_setopt(_autoroute_data.curl_easy, CURLOPT_WRITEDATA, - &_autoroute_data.rdl_data); +curl_easy_setopt(_autoroute_data.curl_easy, CURLOPT_URL, _autoroute_data.src_str); +curl_easy_setopt(_autoroute_data.curl_easy, CURLOPT_WRITEFUNCTION, route_dl_cb_read); +curl_easy_setopt(_autoroute_data.curl_easy, CURLOPT_WRITEDATA, &_autoroute_data.rdl_data); if (!_curl_multi) { /* Initialize CURL. */ _curl_multi = curl_multi_init(); @@ -737,7 +734,7 @@ if (_route.head != _route.tail) { /***/ GtkListStore * -route_generate_store(void) +route_generate_store(Path *route) { WayPoint *wcurr; GtkTreeIter iter; @@ -747,10 +744,10 @@ gchar buffer2[32]; gdouble lat1, lon1, lat2, lon2; gfloat sum=0.0; -if (_route.whead==_route.wtail) +if (route->whead==route->wtail) return NULL; -wcurr = _route.whead; +wcurr=route->whead; if (!wcurr->point) return NULL; @@ -759,7 +756,7 @@ unit2latlon(wcurr->point->unitx, wcurr->point->unity, lat1, lon1); store = gtk_list_store_new(ROUTE_NUM_COLUMNS,G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); -while (wcurr!=_route.wtail) { +while (wcurr!=route->wtail) { if (!wcurr) break; diff --git a/src/route.h b/src/route.h index c703958..fbfd923 100644 --- a/src/route.h +++ b/src/route.h @@ -56,4 +56,7 @@ gboolean route_update_nears(gboolean quick); void route_show_distance_to_last(); void route_show_distance_to_next(); gboolean route_show_distance_to(Point * point); + +GtkListStore *route_generate_store(Path *route); + #endif -- 2.39.5