]> err.no Git - mapper/commitdiff
Ask user to clear track after saving track.
authorKaj-Michael Lang <milang@onion.tal.org>
Tue, 4 Sep 2007 10:20:43 +0000 (13:20 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Tue, 4 Sep 2007 10:20:43 +0000 (13:20 +0300)
src/track.c

index c4294d76d708c32f2b754e66fff33a2ce9a347e4..df8822de71dd9943f1b4662f1c31980d5f2a9c37 100644 (file)
@@ -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."));
        }