… | |
… | |
289 | int result; |
289 | int result; |
290 | GHashTable *dedup=g_hash_table_new_full(g_str_hash,g_str_equal,g_free,NULL); |
290 | GHashTable *dedup=g_hash_table_new_full(g_str_hash,g_str_equal,g_free,NULL); |
291 | |
291 | |
292 | f=fopen(this_->working_file, replace ? "w+" : "a+"); |
292 | f=fopen(this_->working_file, replace ? "w+" : "a+"); |
293 | if (f==NULL) { |
293 | if (f==NULL) { |
294 | navit_add_message(this_->parent->u.navit,_("Failed to write bookmarks file")); |
294 | navit_add_message(this_->parent->u.navit,"Failed to write bookmarks file"); |
295 | return FALSE; |
295 | return FALSE; |
296 | } |
296 | } |
297 | |
297 | |
298 | this_->bookmarks_list=g_list_first(this_->bookmarks_list); |
298 | this_->bookmarks_list=g_list_first(this_->bookmarks_list); |
299 | while (this_->bookmarks_list) { |
299 | while (this_->bookmarks_list) { |
… | |
… | |
360 | |
360 | |
361 | unlink(this_->bookmark_file); |
361 | unlink(this_->bookmark_file); |
362 | result=(rename(this_->working_file,this_->bookmark_file)==0); |
362 | result=(rename(this_->working_file,this_->bookmark_file)==0); |
363 | if (!result) |
363 | if (!result) |
364 | { |
364 | { |
365 | navit_add_message(this_->parent->u.navit,_("Failed to write bookmarks file")); |
365 | navit_add_message(this_->parent->u.navit,"Failed to write bookmarks file"); |
366 | } |
366 | } |
367 | return result; |
367 | return result; |
368 | } |
368 | } |
369 | |
369 | |
370 | /* |
370 | /* |
… | |
… | |
416 | fclose(f); |
416 | fclose(f); |
417 | if (line) { |
417 | if (line) { |
418 | center = transform_center(this_->trans); |
418 | center = transform_center(this_->trans); |
419 | pro = transform_get_projection(this_->trans); |
419 | pro = transform_get_projection(this_->trans); |
420 | coord_parse(g_strchomp(line), pro, center); |
420 | coord_parse(g_strchomp(line), pro, center); |
421 | dbg(0,"******** load center from file *********"); |
421 | dbg(0,"******** load center from file *********\n"); |
422 | free(line); |
422 | free(line); |
423 | } |
423 | } |
424 | return; |
424 | return; |
425 | } |
425 | } |
426 | |
426 | |
427 | void |
427 | void |
428 | bookmarks_write_center_to_file(struct bookmarks *this_, char *file) |
428 | bookmarks_write_center_to_file(struct bookmarks *this_, char *file) |
429 | { |
429 | { |
|
|
430 | dbg(0,"EEnter\n"); |
|
|
431 | |
430 | FILE *f; |
432 | FILE *f; |
431 | enum projection pro; |
433 | enum projection pro; |
432 | struct coord *center; |
434 | struct coord *center; |
433 | |
435 | |
434 | f = fopen(file, "w+"); |
436 | f = fopen(file, "w+"); |
… | |
… | |
453 | |
455 | |
454 | // + center = transform_center(this_->trans); |
456 | // + center = transform_center(this_->trans); |
455 | pro = transform_get_projection(this_->trans); |
457 | pro = transform_get_projection(this_->trans); |
456 | // + coord_print(pro, center, f); |
458 | // + coord_print(pro, center, f); |
457 | coord_print(pro, &c22, f); |
459 | coord_print(pro, &c22, f); |
458 | dbg(0,"******** write center to file *********"); |
|
|
459 | fclose(f); |
460 | fclose(f); |
|
|
461 | dbg(0,"******** write center to file *********\n"); |
460 | } |
462 | } |
461 | else |
463 | else |
462 | { |
464 | { |
463 | perror(file); |
465 | perror(file); |
464 | } |
466 | } |
|
|
467 | |
|
|
468 | dbg(0,"ready\n"); |
|
|
469 | |
465 | return; |
470 | return; |
466 | } |
471 | } |
467 | |
472 | |
468 | static void |
473 | static void |
469 | bookmarks_emit_dbus_signal(struct bookmarks *this_, struct pcoord *c, const char *description,int create) |
474 | bookmarks_emit_dbus_signal(struct bookmarks *this_, struct pcoord *c, const char *description,int create) |