diff options
author | akashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-03-05 13:07:46 +0000 |
---|---|---|
committer | akashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-03-05 13:07:46 +0000 |
commit | e8e6c35c9d3dd500e648835a5be9f633ee244fd5 (patch) | |
tree | 68ba50fc43857fd3d8223a44710caddefb038645 | |
parent | 92b78226f3750c3760c09f46ffbc723f90c1dc42 (diff) | |
download | navit-e8e6c35c9d3dd500e648835a5be9f633ee244fd5.tar.gz |
Add:core:Added bookmark deletion routine
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2982 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/bookmarks.c | 21 | ||||
-rw-r--r-- | navit/bookmarks.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/navit/bookmarks.c b/navit/bookmarks.c index 275ae9489..98d443e5d 100644 --- a/navit/bookmarks.c +++ b/navit/bookmarks.c @@ -329,6 +329,27 @@ bookmarks_add_bookmark(struct bookmarks *this_, struct pcoord *pc, const char *d return result; } +int +bookmarks_del_bookmark(struct bookmarks *this_, const char *description) { + struct bookmark_item_priv *b_item; + int result; + + b_item=(struct bookmark_item_priv*)g_hash_table_lookup(this_->bookmarks_hash,description); + if (b_item) { + this_->bookmarks_list=g_list_first(this_->bookmarks_list); + this_->bookmarks_list=g_list_remove(this_->bookmarks_list,b_item); + + result=bookmarks_store_bookmarks_to_file(this_,0,0); + + callback_list_call_attr_0(this_->attr_cbl, attr_bookmark_map); + bookmarks_clear_hash(this_); + bookmarks_load_hash(this_); + + return result; + } + + return FALSE; +} /** * @param limit Limits the number of entries in the "backlog". Set to 0 for "infinite" */ diff --git a/navit/bookmarks.h b/navit/bookmarks.h index d54425b14..203e64de2 100644 --- a/navit/bookmarks.h +++ b/navit/bookmarks.h @@ -30,7 +30,9 @@ struct bookmarks *bookmarks_new(struct attr *parent,/* struct attr **attrs,*/ st void bookmarks_destroy(struct bookmarks *this_); void bookmarks_add_callback(struct bookmarks *this_, struct callback *cb); int bookmarks_add_bookmark(struct bookmarks *this_, struct pcoord *c, const char *description); +int bookmarks_del_bookmark(struct bookmarks *this_, const char *description); struct map* bookmarks_get_map(struct bookmarks *this_); + char* bookmarks_get_user_data_directory(gboolean create); char* bookmarks_get_destination_file(gboolean create); void bookmarks_set_center_from_file(struct bookmarks *this_, char *file); |