From: Kaj-Michael Lang Date: Tue, 4 Sep 2007 10:20:43 +0000 (+0300) Subject: Ask user to clear track after saving track. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0779bd0eac7748a14d251e37ab0c6847cad2f105;p=mapper Ask user to clear track after saving track. --- diff --git a/src/track.c b/src/track.c index c4294d7..df8822d 100644 --- a/src/track.c +++ b/src/track.c @@ -41,7 +41,7 @@ track_clear(void) { GtkWidget *confirm; -confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Really clear the track?")); +confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Clear the track?")); if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) { _track.tail = _track.head; @@ -53,34 +53,34 @@ gtk_widget_destroy(confirm); gfloat track_calculate_distance_from(Point * point) { - gfloat lat1, lon1, lat2, lon2; - gfloat sum = 0.0; - Point *curr; - unit2latlon(_pos.unitx, _pos.unity, lat1, lon1); - - /* Skip _track.tail because that should be _pos. */ - for (curr = _track.tail; curr > point; --curr) { - if (curr->unity) { - unit2latlon(curr->unitx, curr->unity, lat2, lon2); - sum += calculate_distance(lat1, lon1, lat2, lon2); - lat1 = lat2; - lon1 = lon2; - } +gfloat lat1, lon1, lat2, lon2; +gfloat sum = 0.0; +Point *curr; +unit2latlon(_pos.unitx, _pos.unity, lat1, lon1); + +/* Skip _track.tail because that should be _pos. */ +for (curr = _track.tail; curr > point; --curr) { + if (curr->unity) { + unit2latlon(curr->unitx, curr->unity, lat2, lon2); + sum += calculate_distance(lat1, lon1, lat2, lon2); + lat1 = lat2; + lon1 = lon2; } - return sum; +} +return sum; } void track_show_distance_from(Point * point) { - gchar buffer[80]; - gfloat sum; +gchar buffer[80]; +gfloat sum; - sum = track_calculate_distance_from(point); +sum = track_calculate_distance_from(point); - snprintf(buffer, sizeof(buffer), "%s: %.02f %s", _("Distance"), - sum * UNITS_CONVERT[_units], UNITS_TEXT[_units]); - MACRO_BANNER_SHOW_INFO(_window, buffer); +snprintf(buffer, sizeof(buffer), "%s: %.02f %s", _("Distance"), + sum * UNITS_CONVERT[_units], UNITS_TEXT[_units]); +MACRO_BANNER_SHOW_INFO(_window, buffer); } void @@ -248,6 +248,7 @@ if (file_save(&_track_file_uri, &_track_file_uri, &handle)) { if (write_gpx(&_track, handle)) { MACRO_BANNER_SHOW_INFO(_window, _("Track Saved")); r = TRUE; + track_clear(); } else { popup_error(_window, _("Error writing GPX file.")); }