458 |
printf("uploading way %s from address %p\n", url, xml_str); |
printf("uploading way %s from address %p\n", url, xml_str); |
459 |
|
|
460 |
char *cred = g_strdup_printf("%s:%s", |
char *cred = g_strdup_printf("%s:%s", |
461 |
context->appdata->settings->username, context->appdata->settings->password); |
context->appdata->settings->username, |
462 |
|
context->appdata->settings->password); |
463 |
if(osm_update_item(&context->log, xml_str, url, cred, |
if(osm_update_item(&context->log, xml_str, url, cred, |
464 |
(way->flags & OSM_FLAG_NEW)?&(way->id):NULL)) { |
(way->flags & OSM_FLAG_NEW)?&(way->id):NULL)) { |
465 |
way->flags &= ~(OSM_FLAG_DIRTY | OSM_FLAG_NEW); |
way->flags &= ~(OSM_FLAG_DIRTY | OSM_FLAG_NEW); |
473 |
} |
} |
474 |
} |
} |
475 |
|
|
476 |
|
static void osm_delete_relations(osm_upload_context_t *context) { |
477 |
|
relation_t *relation = context->osm->relation; |
478 |
|
project_t *project = context->project; |
479 |
|
|
480 |
|
while(relation) { |
481 |
|
/* make sure gui gets updated */ |
482 |
|
while(gtk_events_pending()) gtk_main_iteration(); |
483 |
|
|
484 |
|
if(relation->flags & OSM_FLAG_DELETED) { |
485 |
|
printf("deleting relation on server\n"); |
486 |
|
|
487 |
|
appendf(&context->log, _("Delete relation #%ld "), relation->id); |
488 |
|
|
489 |
|
char *url = g_strdup_printf("%s/relation/%lu", |
490 |
|
project->server, relation->id); |
491 |
|
char *cred = g_strdup_printf("%s:%s", |
492 |
|
context->appdata->settings->username, |
493 |
|
context->appdata->settings->password); |
494 |
|
|
495 |
|
if(osm_delete_item(&context->log, url, cred)) { |
496 |
|
relation->flags &= ~(OSM_FLAG_DIRTY | OSM_FLAG_DELETED); |
497 |
|
project->data_dirty = TRUE; |
498 |
|
} |
499 |
|
|
500 |
|
g_free(cred); |
501 |
|
} |
502 |
|
relation = relation->next; |
503 |
|
} |
504 |
|
} |
505 |
|
|
506 |
|
|
507 |
static void osm_upload_relations(osm_upload_context_t *context) { |
static void osm_upload_relations(osm_upload_context_t *context) { |
508 |
relation_t *relation = context->osm->relation; |
relation_t *relation = context->osm->relation; |
722 |
osm_upload_ways(context); |
osm_upload_ways(context); |
723 |
appendf(&context->log, _("Uploading relations:\n")); |
appendf(&context->log, _("Uploading relations:\n")); |
724 |
osm_upload_relations(context); |
osm_upload_relations(context); |
725 |
|
appendf(&context->log, _("Deleting relations:\n")); |
726 |
|
osm_delete_relations(context); |
727 |
appendf(&context->log, _("Deleting ways:\n")); |
appendf(&context->log, _("Deleting ways:\n")); |
728 |
osm_delete_ways(context); |
osm_delete_ways(context); |
729 |
appendf(&context->log, _("Deleting nodes:\n")); |
appendf(&context->log, _("Deleting nodes:\n")); |
730 |
osm_delete_nodes(context); |
osm_delete_nodes(context); |
731 |
|
|
|
|
|
732 |
appendf(&context->log, _("Upload done.\n")); |
appendf(&context->log, _("Upload done.\n")); |
733 |
|
|
734 |
gboolean reload_map = FALSE; |
gboolean reload_map = FALSE; |