From: Kaj-Michael Lang Date: Wed, 23 Jul 2008 09:38:35 +0000 (+0300) Subject: Mapper: More integration fixes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e9f44e007705814ee7324833787fd7fe26887ad;p=mapper Mapper: More integration fixes --- diff --git a/src/cb.c b/src/cb.c index adee9b8..e3bb934 100644 --- a/src/cb.c +++ b/src/cb.c @@ -86,7 +86,7 @@ return TRUE; gboolean menu_cb_route_download(GtkAction *action) { -route_download(_route, NULL); +route_download_dialog(_route, NULL); route_menu_set_sensitive(path_tree_view_update_store(route_tree_view, _route)); return TRUE; } @@ -397,7 +397,7 @@ return TRUE; gboolean menu_cb_maps_select(GtkAction *action, gpointer new_repo) { -gtk_map_set_repo(_map, new_repo); +gtk_map_set_tile_repository(_map, new_repo); return TRUE; } @@ -785,7 +785,7 @@ g_ascii_formatd(strlat, 32, "%.06f", lat); g_ascii_formatd(strlon, 32, "%.06f", lon); g_snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon); -route_download(_route, buffer); +route_download_dialog(_route, buffer); } void @@ -1107,7 +1107,7 @@ gdouble lat, lon; gtk_map_get_menu_latlon(_map, &lat, &lon); if ((way = path_find_nearest_waypoint(_route, lat, lon))) - route_show_distance_to(_route, way->point); + path_show_distance_to(_route, way->point); return TRUE; } diff --git a/src/path-mapper.c b/src/path-mapper.c index d0bf431..dba603a 100644 --- a/src/path-mapper.c +++ b/src/path-mapper.c @@ -104,7 +104,14 @@ if (path && path_has_points(path)) { void path_show_distance_from_last(Path *path) { -path_show_distance_from(path, path_find_last_point(path)); +Point *point; + +g_return_if_fail(path); + +point=path_find_last_point(path); +g_return_if_fail(point); + +path_show_distance_from(path, point); } /** @@ -114,11 +121,13 @@ path_show_distance_from(path, path_find_last_point(path)); void path_show_distance_from_first(Path *path) { +g_return_if_fail(path); + path_show_distance_from(path, path->head); } /** - * route_show_distance_to: + * path_show_distance_to: * * Show the distance from the current GPS location to the given point, * following the route. If point is NULL, then the distance is shown to the @@ -168,7 +177,7 @@ path_show_distance_to_last(Path *route) g_return_if_fail(route); if (route->head != route->tail) { - route_show_distance_to(route, path_find_last_point(route)); + path_show_distance_to(route, path_find_last_point(route)); } else { MACRO_BANNER_SHOW_INFO(_window, _("The current route is empty.")); } @@ -253,7 +262,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, _gps->data.lat, _gps->data.lon); - route_set_destination_from_last(route, &_dest); + path_set_destination_from_last(route, &_dest); return TRUE; } else { popup_error(_window, _("Error parsing route GPX file.")); @@ -439,7 +448,7 @@ return FALSE; * safe to free either string as soon as this function returns. */ gboolean -route_download(Path *route, gchar *to) +route_download_dialog(Path *route, gchar *to) { GtkWidget *dialog; GtkWidget *table; @@ -621,7 +630,7 @@ while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { } g_free(rdl_data.bytes); - route_set_destination_from_last(route, &_dest); + path_set_destination_from_last(route, &_dest); MACRO_BANNER_SHOW_INFO(_window, _("Route Downloaded"));