From: Kaj-Michael Lang Date: Wed, 16 Jul 2008 13:17:09 +0000 (+0300) Subject: More build fixes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ee5b4b9c8c5a67489d5dc414c438d826c991d68;p=mapper More build fixes --- diff --git a/src/cb.c b/src/cb.c index 2b2d395..13653d4 100644 --- a/src/cb.c +++ b/src/cb.c @@ -130,7 +130,7 @@ return TRUE; gboolean menu_cb_route_clear(GtkAction *action) { -if (route_clear(_route)) { +if (path_clear_ask(_route), _("Clear route ?")) { gtk_tree_view_set_model(route_tree_view, NULL); route_menu_set_sensitive(FALSE); } diff --git a/src/path-mapper.c b/src/path-mapper.c index 112376a..3457da2 100644 --- a/src/path-mapper.c +++ b/src/path-mapper.c @@ -44,6 +44,9 @@ struct _OriginToggleInfo { Path *path; }; +static gboolean route_auto_dl_idle_cb(); +static void route_cancel_autoroute(Path *route, gboolean temporary); + /** * path_clear_ask: * @path @@ -71,6 +74,7 @@ return res; } /** + * * */ void @@ -163,8 +167,7 @@ g_return_if_fail(path); if (_autoroute_data.enabled && !_autoroute_data.in_progress && path->near_point_dist_squared > 400) { _autoroute_data.in_progress = TRUE; - show_directions=FALSE; - g_idle_add((GSourceFunc)route_auto_route_dl_idle_cb, NULL); + g_idle_add((GSourceFunc)route_auto_dl_idle_cb, NULL); MACRO_BANNER_SHOW_INFO(_window, _("Recalculating directions...")); } @@ -196,10 +199,10 @@ GnomeVFSHandle *handle; gboolean r = FALSE; if (file_save(&_track_file_uri, &_track_file_uri, &handle)) { - if (path_gpx_write(track, handle)) { + if (path_gpx_write(track, handle, NULL)) { MACRO_BANNER_SHOW_INFO(_window, _("Track Saved")); r = TRUE; - path_clear_ask(track); + path_clear_ask(track, _("Clear track ?")); } else { popup_error(_window, _("Error writing track GPX file.")); } @@ -230,7 +233,7 @@ if (file_open_get_contents(&_route_dir_uri, &buffer, &size)) { MACRO_BANNER_SHOW_INFO(_window, _("Route Opened")); /* Find the nearest route point, if we're connected. */ - path_find_nearest_point(route); + path_find_nearest_point(route, _gps->data.lat, _gps->data.lon); route_set_destination_from_last(route, &_dest); return TRUE; } else { @@ -261,7 +264,7 @@ if (route->head==route->tail) { } if (file_save(&_route_dir_uri, &_route_dir_uri, &handle)) { - if (path_gpx_write(route, handle)) { + if (path_gpx_write(route, handle, NULL)) { MACRO_BANNER_SHOW_INFO(_window, _("Route Saved")); } else { popup_error(_window, _("Error writing route GPX file.")); @@ -309,18 +312,18 @@ return TRUE; * * Cancel the current auto-route. */ -void +static void route_cancel_autoroute(Path *route, gboolean temporary) { if (_autoroute_data.enabled) { if (!temporary) { - _autoroute_data.enabled = FALSE; + _autoroute_data.enabled=FALSE; g_free(_autoroute_data.dest); - _autoroute_data.dest = NULL; + _autoroute_data.dest=NULL; g_free(_autoroute_data.src_str); - _autoroute_data.src_str = NULL; + _autoroute_data.src_str=NULL; } if (_autoroute_data.curl_easy) { @@ -328,14 +331,14 @@ if (_autoroute_data.enabled) { curl_multi_remove_handle(_autoroute_data.curl_multi, _autoroute_data.curl_easy); curl_easy_cleanup(_autoroute_data.curl_easy); curl_multi_cleanup(_autoroute_data.curl_multi); - _autoroute_data.curl_easy = NULL; - _autoroute_data.curl_multi = NULL; + _autoroute_data.curl_easy=NULL; + _autoroute_data.curl_multi=NULL; } g_free(_autoroute_data.rdl_data.bytes); - _autoroute_data.rdl_data.bytes = NULL; - _autoroute_data.rdl_data.bytes_read = 0; - _autoroute_data.in_progress = FALSE; + _autoroute_data.rdl_data.bytes=NULL; + _autoroute_data.rdl_data.bytes_read=0; + _autoroute_data.in_progress=FALSE; } } @@ -358,8 +361,11 @@ while (_autoroute_data.curl_multi && (msg = curl_multi_info_read(_autoroute_data path_find_nearest_point(_route, _gps->data.lat, _gps->data.lon); } route_cancel_autoroute(_route, TRUE); /* We're done. Clean up. */ + return FALSE; } } +return TRUE; +} /** * Read the data provided by the given handle as GPX data, updating the @@ -428,6 +434,8 @@ gboolean r=FALSE; oti.path=route; +memset(&_autoroute_data, 0, sizeof(_autoroute_data)); + dialog = gtk_dialog_new_with_buttons(_("Download Route"), GTK_WINDOW(_window), GTK_DIALOG_MODAL, GTK_STOCK_OK, @@ -547,7 +555,7 @@ while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { /* Attempt to download the route from the server. */ MACRO_CURL_EASY_INIT(curl_easy); curl_easy_setopt(curl_easy, CURLOPT_URL, buffer); - curl_easy_setopt(curl_easy, CURLOPT_WRITEFUNCTION, route_dl_cb_read); + curl_easy_setopt(curl_easy, CURLOPT_WRITEFUNCTION, route_auto_dl_read_cb); curl_easy_setopt(curl_easy, CURLOPT_WRITEDATA, &rdl_data); if (CURLE_OK != curl_easy_perform(curl_easy)) { popup_error(dialog, _("Failed to connect to GPX Directions server")); @@ -570,7 +578,7 @@ while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { GtkTreeIter iter; /* Find the nearest route point, if we're connected. */ - path_find_nearest_point(route); + path_find_nearest_point(route, _gps->data.lat, _gps->data.lon); /* Cancel any autoroute that might be occurring. */ route_cancel_autoroute(route, FALSE); @@ -620,7 +628,6 @@ return r; gboolean track_insert_mark(Path *track) { -gdouble lat, lon; gchar tmp1[16], tmp2[16], *p_latlon; GtkWidget *dialog; GtkWidget *table; @@ -640,10 +647,9 @@ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table = gtk_table_new(2, 2 gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Near Lat, Lon")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); -unit2latlon(_gps->data.unitx, _gps->data.unity, &lat, &lon); -lat_format(_degformat, lat, tmp1); -lon_format(_degformat, lon, tmp2); -p_latlon = g_strdup_printf("%s, %s", tmp1, tmp2); +lat_format(_degformat, _gps->data.lat, tmp1); +lon_format(_degformat, _gps->data.lon, tmp2); +p_latlon=g_strdup_printf("%s, %s", tmp1, tmp2); gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(p_latlon), 1, 2, 0, 1, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); g_free(p_latlon); @@ -651,13 +657,13 @@ g_free(p_latlon); gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Description")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); -txt_scroll = gtk_scrolled_window_new(NULL, NULL); +txt_scroll=gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(txt_scroll), GTK_SHADOW_IN); gtk_table_attach(GTK_TABLE(table), txt_scroll, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(txt_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); -txt_desc = gtk_text_view_new(); +txt_desc=gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(txt_desc), GTK_WRAP_WORD); gtk_container_add(GTK_CONTAINER(txt_scroll), txt_desc); @@ -670,7 +676,7 @@ while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { GtkTextBuffer *tbuf; GtkTextIter ti1, ti2; - tbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt_desc)); + tbuf=gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt_desc)); gtk_text_buffer_get_iter_at_offset(tbuf, &ti1, 0); gtk_text_buffer_get_end_iter(tbuf, &ti2); diff --git a/src/path-mapper.h b/src/path-mapper.h index 5af2969..88504b1 100644 --- a/src/path-mapper.h +++ b/src/path-mapper.h @@ -35,6 +35,8 @@ gboolean route_save(Path *route); gboolean route_download(Path *route, gchar *to); gboolean route_clear(Path *route); +gboolean path_clear_ask(Path *path, const gchar *msg); + void route_autoroute_check(Path *route); gboolean route_show_distance_to(Path *route, Point *point); void route_show_distance_to_last(Path *route); diff --git a/src/poi-gui.c b/src/poi-gui.c index 9b1686b..bdb418d 100644 --- a/src/poi-gui.c +++ b/src/poi-gui.c @@ -29,7 +29,7 @@ #include "osm-db.h" #include "dialogs.h" #include "help.h" -#include "track.h" +#include "path.h" #include "poi-gui.h" #include "position.h" diff --git a/src/ui-common.c b/src/ui-common.c index 14f8655..1912f5b 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -35,8 +35,8 @@ #include "filter.h" #include "dialogs.h" #include "settings-gui.h" -#include "map-repo.h" #include "poi-gui.h" +#include "map-repo-manager.h" #ifdef WITH_GST #include "audio-note.h" @@ -760,8 +760,6 @@ ui_notebook.audio=gtk_notebook_append_page(notebook, an_ui->vbox, label); menu_maps_add_repos(); menu_init_cmenu(); -memset(&_autoroute_data, 0, sizeof(_autoroute_data)); - g_signal_connect(G_OBJECT(_window), "delete_event", G_CALLBACK(mapper_cb_quit), NULL); g_signal_connect(G_OBJECT(_window), "destroy", G_CALLBACK(gtk_main_quit), NULL);