]> err.no Git - mapper/commitdiff
Start to remove usage of global _route, begin with route store generator.
authorKaj-Michael Lang <milang@tal.org>
Tue, 6 Nov 2007 09:34:23 +0000 (11:34 +0200)
committerKaj-Michael Lang <milang@tal.org>
Tue, 6 Nov 2007 09:34:23 +0000 (11:34 +0200)
src/cb.c
src/route.c
src/route.h

index 8a78181186f97c7e76096b0618f9d8d726dc0b4e..d538ec37ff313fe3dffc5d255ccf8e012cfe0d3c 100644 (file)
--- 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));
index beba25953c7130ed741cfc04bd1646531eeecf53..afb73c03374f3f72ba26767d57ed396003451da6 100644 (file)
@@ -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;
 
index c70395807ad5dbf6592400b42096a3c1d83639a9..fbfd923114d7272833bdf76b1934551b028924b8 100644 (file)
@@ -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