navit.c (navit-0.5.5) | : | navit.c (navit-0.5.6) | ||
---|---|---|---|---|
skipping to change at line 1598 | skipping to change at line 1598 | |||
bookmarks_append_destinations(this_->former_destination, destination_fil e, c, 1, type_former_destination, description, | bookmarks_append_destinations(this_->former_destination, destination_fil e, c, 1, type_former_destination, description, | |||
this_->recentdest_count); | this_->recentdest_count); | |||
} else { | } else { | |||
this_->destination_valid=0; | this_->destination_valid=0; | |||
bookmarks_append_destinations(this_->former_destination, destination_fil e, NULL, 0, type_former_destination, NULL, | bookmarks_append_destinations(this_->former_destination, destination_fil e, NULL, 0, type_former_destination, NULL, | |||
this_->recentdest_count); | this_->recentdest_count); | |||
navit_mark_navigation_stopped(destination_file); | navit_mark_navigation_stopped(destination_file); | |||
} | } | |||
g_free(destination_file); | g_free(destination_file); | |||
callback_list_call_attr_0(this_->attr_cbl, attr_destination); | ||||
if (this_->route) { | if (this_->route) { | |||
struct attr attr; | struct attr attr; | |||
int dstcount; | int dstcount; | |||
struct pcoord *pc; | struct pcoord *pc; | |||
navit_get_attr(this_, attr_waypoints_flag, &attr, NULL); | navit_get_attr(this_, attr_waypoints_flag, &attr, NULL); | |||
if (this_->waypoints_flag==0 || route_get_destination_count(this_->route )==0) { | if (this_->waypoints_flag==0 || route_get_destination_count(this_->route )==0) { | |||
route_set_destination(this_->route, c, async); | route_set_destination(this_->route, c, async); | |||
} else { | } else { | |||
route_append_destination(this_->route, c, async); | route_append_destination(this_->route, c, async); | |||
skipping to change at line 1622 | skipping to change at line 1620 | |||
dstcount=route_get_destination_count(this_->route); | dstcount=route_get_destination_count(this_->route); | |||
if(dstcount>0) { | if(dstcount>0) { | |||
destination_file = bookmarks_get_destination_file(TRUE); | destination_file = bookmarks_get_destination_file(TRUE); | |||
pc=g_new(struct pcoord,dstcount); | pc=g_new(struct pcoord,dstcount); | |||
route_get_destinations(this_->route,pc,dstcount); | route_get_destinations(this_->route,pc,dstcount); | |||
bookmarks_append_destinations(this_->former_destination, destination _file, pc, dstcount, type_former_itinerary, | bookmarks_append_destinations(this_->former_destination, destination _file, pc, dstcount, type_former_itinerary, | |||
description, this_->recentdest_count); | description, this_->recentdest_count); | |||
g_free(pc); | g_free(pc); | |||
g_free(destination_file); | g_free(destination_file); | |||
} | } | |||
if (this_->ready == 3 && !(this_->flags & 4)) | ||||
navit_draw(this_); | ||||
} | } | |||
callback_list_call_attr_0(this_->attr_cbl, attr_destination); | ||||
if (this_->route && this_->ready == 3 && !(this_->flags & 4)) | ||||
navit_draw(this_); | ||||
} | } | |||
/** | /** | |||
* Add destination description to the recent dest file. Doesn't start routing. | * Add destination description to the recent dest file. Doesn't start routing. | |||
* | * | |||
* @param navit The navit instance | * @param navit The navit instance | |||
* @param c The coordinate to start routing to | * @param c The coordinate to start routing to | |||
* @param description A label which allows the user to later identify this desti nation in the former destinations selection | * @param description A label which allows the user to later identify this desti nation in the former destinations selection | |||
* @returns nothing | * @returns nothing | |||
*/ | */ | |||
skipping to change at line 1667 | skipping to change at line 1667 | |||
if (c && count) { | if (c && count) { | |||
this_->destination=c[count-1]; | this_->destination=c[count-1]; | |||
this_->destination_valid=1; | this_->destination_valid=1; | |||
destination_file = bookmarks_get_destination_file(TRUE); | destination_file = bookmarks_get_destination_file(TRUE); | |||
bookmarks_append_destinations(this_->former_destination, destination_fil e, c, count, type_former_itinerary, description, | bookmarks_append_destinations(this_->former_destination, destination_fil e, c, count, type_former_itinerary, description, | |||
this_->recentdest_count); | this_->recentdest_count); | |||
g_free(destination_file); | g_free(destination_file); | |||
} else | } else | |||
this_->destination_valid=0; | this_->destination_valid=0; | |||
callback_list_call_attr_0(this_->attr_cbl, attr_destination); | if (this_->route) | |||
if (this_->route) { | ||||
route_set_destinations(this_->route, c, count, async); | route_set_destinations(this_->route, c, count, async); | |||
if (this_->ready == 3) | callback_list_call_attr_0(this_->attr_cbl, attr_destination); | |||
navit_draw(this_); | if (this_->route && this_->ready == 3) | |||
} | navit_draw(this_); | |||
} | } | |||
/** | ||||
* @brief Retrieves destinations from the route | ||||
* | ||||
* Prior to calling this method, you may want to retrieve the number of destinat | ||||
ions by calling | ||||
* {@link navit_get_destination_count(struct navit *)} and assigning a buffer of | ||||
sufficient capacity. | ||||
* | ||||
* If the return value equals `count`, the buffer was either just large enough o | ||||
r too small to hold the | ||||
* entire list of destinations; there is no way to tell from the result which is | ||||
the case. | ||||
* | ||||
* If the Navit instance does not have a route, the result is 0. | ||||
* | ||||
* @param this_ The Navit instance | ||||
* @param pc Pointer to an array of projected coordinates which will receive the | ||||
destination coordinates | ||||
* @param count Capacity of `pc` | ||||
* @return The number of destinations stored in `pc`, never greater than `count` | ||||
*/ | ||||
int navit_get_destinations(struct navit *this_, struct pcoord *pc, int count) { | int navit_get_destinations(struct navit *this_, struct pcoord *pc, int count) { | |||
if(!this_->route) | if(!this_->route) | |||
return 0; | return 0; | |||
return route_get_destinations(this_->route, pc, count); | return route_get_destinations(this_->route, pc, count); | |||
} | } | |||
/** | ||||
* @brief Get the destinations count for the route | ||||
* | ||||
* @param this The Navit instance | ||||
* @return destination count for the route, or 0 if the Navit instance has no ro | ||||
ute | ||||
*/ | ||||
int navit_get_destination_count(struct navit *this_) { | int navit_get_destination_count(struct navit *this_) { | |||
if(!this_->route) | if(!this_->route) | |||
return 0; | return 0; | |||
return route_get_destination_count(this_->route); | return route_get_destination_count(this_->route); | |||
} | } | |||
char* navit_get_destination_description(struct navit *this_, int n) { | char* navit_get_destination_description(struct navit *this_, int n) { | |||
if(!this_->route) | if(!this_->route) | |||
return NULL; | return NULL; | |||
return route_get_destination_description(this_->route, n); | return route_get_destination_description(this_->route, n); | |||
skipping to change at line 3662 | skipping to change at line 3683 | |||
/** | /** | |||
* @brief Returns whether redraw operations are currently blocked. | * @brief Returns whether redraw operations are currently blocked. | |||
*/ | */ | |||
int navit_get_blocked(struct navit *this_) { | int navit_get_blocked(struct navit *this_) { | |||
return this_->blocked; | return this_->blocked; | |||
} | } | |||
void navit_destroy(struct navit *this_) { | void navit_destroy(struct navit *this_) { | |||
dbg(lvl_debug,"enter %p",this_); | dbg(lvl_debug,"enter %p",this_); | |||
GList *mapsets; | ||||
struct map * map; | ||||
struct attr attr; | ||||
graphics_draw_cancel(this_->gra, this_->displaylist); | graphics_draw_cancel(this_->gra, this_->displaylist); | |||
mapsets = this_->mapsets; | ||||
while (mapsets) { | ||||
GList *maps = NULL; | ||||
struct mapset_handle *msh; | ||||
msh = mapset_open(mapsets->data); | ||||
while (msh && (map = mapset_next(msh, 0))) { | ||||
/* Add traffic map (identified by the `attr_traffic` attribute) to l | ||||
ist of maps to remove */ | ||||
if (map_get_attr(map, attr_traffic, &attr, NULL)) | ||||
maps = g_list_append(maps, map); | ||||
} | ||||
mapset_close(msh); | ||||
/* Remove traffic maps, if any */ | ||||
while (maps) { | ||||
attr.type = attr_map; | ||||
attr.u.map = maps->data; | ||||
mapset_remove_attr(mapsets->data, &attr); | ||||
attr_free_content(&attr); | ||||
maps = g_list_next(maps); | ||||
} | ||||
if (maps) | ||||
g_list_free(maps); | ||||
mapsets = g_list_next(mapsets); | ||||
} | ||||
callback_list_call_attr_1(this_->attr_cbl, attr_destroy, this_); | callback_list_call_attr_1(this_->attr_cbl, attr_destroy, this_); | |||
attr_list_free(this_->attrs); | attr_list_free(this_->attrs); | |||
if(cmd_int_var_hash) { | if(cmd_int_var_hash) { | |||
g_hash_table_destroy(cmd_int_var_hash); | g_hash_table_destroy(cmd_int_var_hash); | |||
cmd_int_var_hash=NULL; | cmd_int_var_hash=NULL; | |||
} | } | |||
if(cmd_attr_var_hash) { | if(cmd_attr_var_hash) { | |||
g_hash_table_destroy(cmd_attr_var_hash); | g_hash_table_destroy(cmd_attr_var_hash); | |||
cmd_attr_var_hash=NULL; | cmd_attr_var_hash=NULL; | |||
End of changes. 9 change blocks. | ||||
10 lines changed or deleted | 67 lines changed or added |