From: Kaj-Michael Lang Date: Tue, 15 Apr 2008 10:31:46 +0000 (+0300) Subject: Fix waypoint announce loop X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15ad858bb2418de0d84edbb904edb8dba0b51e8a;p=mapper Fix waypoint announce loop --- diff --git a/src/route.c b/src/route.c index 5b1c840..4058ca0 100644 --- a/src/route.c +++ b/src/route.c @@ -37,6 +37,8 @@ static gboolean show_directions=TRUE; +static WayPoint *announced_waypoint=NULL; + typedef struct _OriginToggleInfo OriginToggleInfo; struct _OriginToggleInfo { GtkWidget *rad_use_gps; @@ -61,12 +63,13 @@ confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Really clear the if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) { route_cancel_autoroute(FALSE); + announced_waypoint=NULL; path_free(_route); _route=path_new(); route_find_nearest_point(); map_force_redraw(); } -_dest.valid=FALSE; + gtk_widget_destroy(confirm); } @@ -89,8 +92,11 @@ if (!_next_way) announce_thres_unsquared=(20+(guint)gps->speed)*_announce_notice_ratio*3; -if (_next_way_dist_squared < (announce_thres_unsquared * announce_thres_unsquared)) +if (_next_way_dist_squared<(announce_thres_unsquared * announce_thres_unsquared) && _next_way!=announced_waypoint) { announce_waypoint(_next_way->desc); + announced_waypoint=_next_way; +} + } /**