--- trunk/src/gpx.c 2009/06/25 15:24:24 7 +++ trunk/src/gpx.c 2009/07/29 19:24:15 34 @@ -155,7 +155,7 @@ gtk_window_set_title(GTK_WINDOW(dialog->dialog), _("Loading")); gtk_window_set_default_size(GTK_WINDOW(dialog->dialog), 300, 10); - gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); + gtk_window_set_modal(GTK_WINDOW(dialog->dialog), TRUE); gtk_window_set_transient_for(GTK_WINDOW(dialog->dialog), GTK_WINDOW(parent)); dialog->label = gtk_label_new("---"); @@ -764,6 +764,7 @@ /* neither geocaching.com GC* nor opencaching.com OC* nor */ /* geocaching australia GA* waypoint */ if(cache->id && + (strncasecmp(cache->id, "__", 2) != 0) && (strncasecmp(cache->id, "GC", 2) != 0) && (strncasecmp(cache->id, "OC", 2) != 0) && (strncasecmp(cache->id, "GA", 2) != 0)) { @@ -1069,9 +1070,7 @@ *dot = 0; snprintf(wpts_name, sizeof(wpts_name), "%s-wpts.gpx", filename); *dot = '.'; - if(g_file_test(wpts_name, G_FILE_TEST_EXISTS)) { - xmlTextReaderPtr reader = xmlReaderForFile(wpts_name, NULL, 0); if (reader != NULL) { gpx = process_root(reader, dialog, wpts_name, gpx); @@ -1347,7 +1346,7 @@ void gpx_pos_get_distance_str(char *str, int len, pos_t p1, pos_t p2, int mil) { - if(!p1.lat && !p1.lon) { + if(isnan(p1.lat) || isnan(p1.lon)) { snprintf(str, len, "---"); return; } @@ -1356,7 +1355,6 @@ distance_str(str, len, dist, mil); } -/* http://library.gnome.org/devel/gtk/unstable/GtkRadioButton.html */ void gpx_sort(gpx_t *gpx, int by, pos_t *refpos) { cache_t **new; cache_t *cur = gpx->cache; @@ -1365,9 +1363,12 @@ gpx->cache = NULL; /* detach old chain */ while(cur) { - float cur_dist = gpx_pos_get_distance(*refpos, gpx_cache_pos(cur), 0); + float cur_dist = -1; int cur_cnt = 0; + if(!isnan(cur->pos.lat) && !isnan(cur->pos.lon)) + cur_dist = gpx_pos_get_distance(*refpos, gpx_cache_pos(cur), 0); + new = &(gpx->cache); /* search for currect insertion point */