Diff of /trunk/src/gpx.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1 by harbaum, Sat Jun 20 11:08:47 2009 UTC revision 30 by harbaum, Fri Jul 24 19:24:42 2009 UTC
# Line 152  gpx_dialog_t *gpx_busy_dialog_new(GtkWid Line 152  gpx_dialog_t *gpx_busy_dialog_new(GtkWid
152    dialog->dialog = gtk_dialog_new();    dialog->dialog = gtk_dialog_new();
153    
154    gtk_dialog_set_has_separator(GTK_DIALOG(dialog->dialog), FALSE);    gtk_dialog_set_has_separator(GTK_DIALOG(dialog->dialog), FALSE);
155    gtk_window_set_title(GTK_WINDOW(dialog->dialog), _("Loading..."));    gtk_window_set_title(GTK_WINDOW(dialog->dialog), _("Loading"));
156    gtk_window_set_default_size(GTK_WINDOW(dialog->dialog), 300, 10);    gtk_window_set_default_size(GTK_WINDOW(dialog->dialog), 300, 10);
157    
158    gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);    gtk_window_set_modal(GTK_WINDOW(dialog->dialog), TRUE);
159    gtk_window_set_transient_for(GTK_WINDOW(dialog->dialog), GTK_WINDOW(parent));    gtk_window_set_transient_for(GTK_WINDOW(dialog->dialog), GTK_WINDOW(parent));
160    
161    dialog->label = gtk_label_new("---");    dialog->label = gtk_label_new("---");
# Line 764  static cache_t *process_gpx_wpt(xmlTextR Line 764  static cache_t *process_gpx_wpt(xmlTextR
764        /* neither geocaching.com GC* nor opencaching.com OC* nor */        /* neither geocaching.com GC* nor opencaching.com OC* nor */
765        /* geocaching australia GA* waypoint */        /* geocaching australia GA* waypoint */
766        if(cache->id &&        if(cache->id &&
767             (strncasecmp(cache->id, "__", 2) != 0) &&
768           (strncasecmp(cache->id, "GC", 2) != 0) &&           (strncasecmp(cache->id, "GC", 2) != 0) &&
769           (strncasecmp(cache->id, "OC", 2) != 0) &&           (strncasecmp(cache->id, "OC", 2) != 0) &&
770           (strncasecmp(cache->id, "GA", 2) != 0)) {           (strncasecmp(cache->id, "GA", 2) != 0)) {
# Line 1069  static gpx_t *gpx_parse_file(gpx_dialog_ Line 1070  static gpx_t *gpx_parse_file(gpx_dialog_
1070      *dot = 0;      *dot = 0;
1071      snprintf(wpts_name, sizeof(wpts_name), "%s-wpts.gpx", filename);      snprintf(wpts_name, sizeof(wpts_name), "%s-wpts.gpx", filename);
1072      *dot = '.';      *dot = '.';
   
1073      if(g_file_test(wpts_name,  G_FILE_TEST_EXISTS)) {      if(g_file_test(wpts_name,  G_FILE_TEST_EXISTS)) {
   
1074        xmlTextReaderPtr reader = xmlReaderForFile(wpts_name, NULL, 0);        xmlTextReaderPtr reader = xmlReaderForFile(wpts_name, NULL, 0);
1075        if (reader != NULL) {        if (reader != NULL) {
1076          gpx = process_root(reader, dialog, wpts_name, gpx);          gpx = process_root(reader, dialog, wpts_name, gpx);
# Line 1356  void gpx_pos_get_distance_str(char *str, Line 1355  void gpx_pos_get_distance_str(char *str,
1355    distance_str(str, len, dist, mil);    distance_str(str, len, dist, mil);
1356  }  }
1357    
 /* http://library.gnome.org/devel/gtk/unstable/GtkRadioButton.html */  
1358  void gpx_sort(gpx_t *gpx, int by, pos_t *refpos) {  void gpx_sort(gpx_t *gpx, int by, pos_t *refpos) {
1359    cache_t **new;    cache_t **new;
1360    cache_t *cur = gpx->cache;    cache_t *cur = gpx->cache;
# Line 1365  void gpx_sort(gpx_t *gpx, int by, pos_t Line 1363  void gpx_sort(gpx_t *gpx, int by, pos_t
1363    
1364    gpx->cache = NULL;  /* detach old chain */    gpx->cache = NULL;  /* detach old chain */
1365    while(cur) {    while(cur) {
1366      float cur_dist = gpx_pos_get_distance(*refpos, gpx_cache_pos(cur), 0);      float cur_dist = -1;
1367      int cur_cnt = 0;      int cur_cnt = 0;
1368    
1369        if(!isnan(cur->pos.lat) && !isnan(cur->pos.lon))
1370          cur_dist = gpx_pos_get_distance(*refpos, gpx_cache_pos(cur), 0);
1371    
1372      new = &(gpx->cache);      new = &(gpx->cache);
1373    
1374      /* search for currect insertion point */      /* search for currect insertion point */

Legend:
Removed from v.1  
changed lines
  Added in v.30