diff options
author | akashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-04-28 11:09:33 +0000 |
---|---|---|
committer | akashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-04-28 11:09:33 +0000 |
commit | 1c8deef1e4d5f07be7ad1685cb002ecc97d84c9e (patch) | |
tree | 0b926fdb05d1766979910f1acb478f018e75634e /navit/bookmarks.c | |
parent | 04bd4883b6db8053e524ad499eb06bc50c6dbbb6 (diff) | |
download | navit-1c8deef1e4d5f07be7ad1685cb002ecc97d84c9e.tar.gz |
Fix:core:Fixed bookmarks map reloading on change
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3198 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/bookmarks.c')
-rw-r--r-- | navit/bookmarks.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/navit/bookmarks.c b/navit/bookmarks.c index 3bc7caa4b..6489de406 100644 --- a/navit/bookmarks.c +++ b/navit/bookmarks.c @@ -108,7 +108,7 @@ struct item* bookmarks_get_item(struct bookmarks* this_) { return ret; } -char* bookmarks_item_cwd(struct bookmarks* this_) { +const char* bookmarks_item_cwd(struct bookmarks* this_) { return this_->current->label; } @@ -137,6 +137,11 @@ bookmarks_load_hash(struct bookmarks *this_) { struct coord c; char *pos,*finder; + if (this_->mr) { + map_rect_destroy(this_->mr); + } + this_->mr=map_rect_new(this_->bookmark, NULL); + this_->bookmarks_hash=g_hash_table_new(g_str_hash, g_str_equal); this_->root=g_new0(struct bookmark_item_priv,1); this_->root->type=type_none; @@ -209,7 +214,6 @@ bookmarks_new(struct attr *parent, /*struct attr **attrs,*/struct transformation struct attr type={attr_type, {"textfile"}}, data={attr_data, {this_->bookmark_file}}; struct attr *attrs[]={&type, &data, NULL}; this_->bookmark=map_new(this_->parent, attrs); - this_->mr=map_rect_new(this_->bookmark, NULL); bookmarks_load_hash(this_); } @@ -221,7 +225,6 @@ bookmarks_destroy(struct bookmarks *this_) { bookmarks_clear_hash(this_); - map_rect_destroy(this_->mr); map_destroy(this_->bookmark); callback_list_destroy(this_->attr_cbl); @@ -431,19 +434,20 @@ bookmarks_write_center_to_file(struct bookmarks *this_, char *file) int bookmarks_add_bookmark(struct bookmarks *this_, struct pcoord *pc, const char *description) { - struct bookmark_item_priv b_item; + struct bookmark_item_priv *b_item=g_new0(struct bookmark_item_priv,1); int result; - b_item.c.x=pc->x; - b_item.c.y=pc->y; - b_item.label=(char *)description; - b_item.type=type_bookmark; - b_item.parent=this_->current; + b_item->c.x=pc->x; + b_item->c.y=pc->y; + b_item->label=strdup(description); + b_item->type=type_bookmark; + b_item->parent=this_->current; + b_item->children=NULL; this_->current->children=g_list_first(this_->current->children); - this_->current->children=g_list_prepend(this_->current->children,&b_item); + this_->current->children=g_list_prepend(this_->current->children,b_item); this_->bookmarks_list=g_list_first(this_->bookmarks_list); - this_->bookmarks_list=g_list_prepend(this_->bookmarks_list,&b_item); + this_->bookmarks_list=g_list_prepend(this_->bookmarks_list,b_item); result=bookmarks_store_bookmarks_to_file(this_,0,0); |