{
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;
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
if (write_gpx(&_track, handle)) {
MACRO_BANNER_SHOW_INFO(_window, _("Track Saved"));
r = TRUE;
+ track_clear();
} else {
popup_error(_window, _("Error writing GPX file."));
}