struct attr **list = g_new0(struct attr *,2);
if(!cmd_int_var_hash) {
struct attr*val = g_new0(struct attr,1);
+ cmd_attr_var_hash = g_hash_table_new(g_str_hash, g_str_equal);
val->type = attr_type_item_begin;
val->u.item = NULL;
list[0] = val;
struct attr **list = g_new0(struct attr *,2);
if(!cmd_int_var_hash) {
struct attr*val = g_new0(struct attr,1);
+ cmd_int_var_hash = g_hash_table_new(g_str_hash, g_str_equal);
val->type = attr_type_int_begin;
val->u.num = 0;
list[0] = val;
if (in && in[0] && ATTR_IS_STRING(in[0]->type) && in[0]->u.str) {
struct attr*ret = g_hash_table_lookup(cmd_int_var_hash, in[0]->u.str);
if(ret) {
- list[0] = ret;
+ list[0] = attr_dup(ret);
}
else {
struct attr*val = g_new0(struct attr,1);
this_->destination=*c;
this_->destination_valid=1;
- dbg(1, "navit->navit_set_destination %i\n", c->x);
- dbg(1, "navit->navit_set_destination %i\n", c->y);
-
+ dbg(1, "c=(%i,%i)\n", c->x,c->y);
+ destination_file = bookmarks_get_destination_file(TRUE);
+ bookmarks_append_coord(this_->former_destination, destination_file, c, type_former_destination, description, this_->recentdest_count);
+ g_free(destination_file);
} else
this_->destination_valid=0;
- destination_file = bookmarks_get_destination_file(TRUE);
- bookmarks_append_coord(this_->bookmarks, destination_file, c, 1, "former_destination", description, NULL, this_->recentdest_count);
- g_free(destination_file);
callback_list_call_attr_0(this_->attr_cbl, attr_destination);
if (this_->route) {
route_set_destination(this_->route, c, async);
if (c && count) {
this_->destination=c[count-1];
this_->destination_valid=1;
+
+ destination_file = bookmarks_get_destination_file(TRUE);
+ bookmarks_append_coord(this_->former_destination, destination_file, c, type_former_itinerary, description, this_->recentdest_count);
+ g_free(destination_file);
} else
this_->destination_valid=0;
- destination_file = bookmarks_get_destination_file(TRUE);
- bookmarks_append_coord(this_->bookmarks, destination_file, c, count, "former_itinerary", description, NULL, this_->recentdest_count);
- g_free(destination_file);
callback_list_call_attr_0(this_->attr_cbl, attr_destination);
if (this_->route) {
route_set_destinations(this_->route, c, count, async);
return active;
}
-static void
-navit_add_former_destinations_from_file(struct navit *this_)
-{
+struct map* read_former_destinations_from_file(){
+ struct attr type, data, flags, *attrs[4];
char *destination_file = bookmarks_get_destination_file(FALSE);
- struct attr *attrs[4];
- struct map_rect *mr;
- struct item *item;
- int i,valid=0,count=0;
- struct coord c[16];
- struct pcoord pc[16];
- struct attr parent;
- struct attr type;
- struct attr data;
- struct attr flags;
-
- parent.type=attr_navit;
- parent.u.navit=this_;
+ struct map *m;
type.type=attr_type;
type.u.str="textfile";
attrs[0]=&type; attrs[1]=&data; attrs[2]=&flags; attrs[3]=NULL;
- this_->former_destination=map_new(&parent, attrs);
+ m=map_new(NULL, attrs);
g_free(destination_file);
+ return m;
+}
+
+static void
+navit_add_former_destinations_from_file(struct navit *this_)
+{
+ struct item *item;
+ int i,valid=0,count=0;
+ struct coord c[16];
+ struct pcoord pc[16];
+ struct map_rect *mr;
+
+ this_->former_destination=read_former_destinations_from_file();
if (!this_->route || !navit_former_destinations_active(this_))
return;
mr=map_rect_new(this_->former_destination, NULL);
void
navit_say(struct navit *this_, char *text)
{
+ struct attr attr;
if(this_->speech) {
- speech_say(this_->speech, text);
+ if (!speech_get_attr(this_->speech, attr_active, &attr, NULL))
+ attr.u.num = 1;
+ dbg(1, "this_.speech->active %i\n", attr.u.num);
+ if(attr.u.num)
+ speech_say(this_->speech, text);
}
}
{
dbg(0, "enter\n");
navigation_unregister_callback(this_->navigation, attr_navigation_long, this_->roadbook_callback);
+ callback_destroy(this_->roadbook_callback);
this_->roadbook_window=NULL;
this_->roadbook_callback=NULL;
}
navit_set_center(this_, &pc, set_timeout);
}
-#if 0
- switch((*attrs)->type) {
- case attr_zoom:
- zoom=(*attrs)->u.num;
- break;
- case attr_center:
- g=*((*attrs)->u.coord_geo);
- break;
-#endif
-
static int
navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
{
route_remove_waypoint(this_->route);
count=route_get_destinations(this_->route, pc, 16);
destination_file = bookmarks_get_destination_file(TRUE);
- bookmarks_append_coord(this_->bookmarks, destination_file, pc, count, "former_itinerary_part", NULL, NULL, this_->recentdest_count);
+ bookmarks_append_coord(this_->former_destination, destination_file, pc, type_former_itinerary_part, NULL, this_->recentdest_count);
break;
case 2:
navit_set_destination(this_, NULL, NULL, 0);