diff options
author | akashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-04-28 13:33:42 +0000 |
---|---|---|
committer | akashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-04-28 13:33:42 +0000 |
commit | f3e14f0b6e622975370168fe74e5cabf620fda92 (patch) | |
tree | e0d364f61d31df28cf3b958d1f93c28b4c9a86cb /navit/bookmarks.c | |
parent | fa2fd33cfa1c431d71ea78fb0b3944135b722347 (diff) | |
download | navit-f3e14f0b6e622975370168fe74e5cabf620fda92.tar.gz |
Fix:core:Bookmark paste operation is hierarchy-aware now
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3204 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/bookmarks.c')
-rw-r--r-- | navit/bookmarks.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/navit/bookmarks.c b/navit/bookmarks.c index f62e7b5bf..32cdc49a0 100644 --- a/navit/bookmarks.c +++ b/navit/bookmarks.c @@ -494,25 +494,33 @@ bookmarks_copy_bookmark(struct bookmarks *this_, const char *label) { return FALSE; } int -bookmarks_paste_bookmark(struct bookmarks *this_, const char* path) { - char *fullLabel; +bookmarks_paste_bookmark(struct bookmarks *this_) { int result; - struct pcoord pc; + struct bookmark_item_priv* b_item; + + if (!this_->clipboard->label) { + return FALSE; + } + + b_item=g_new0(struct bookmark_item_priv,1); + b_item->c.x=this_->clipboard->c.x; + b_item->c.y=this_->clipboard->c.y; + b_item->label=strdup(this_->clipboard->label); + b_item->type=this_->clipboard->type; + b_item->item=this_->clipboard->item; + b_item->parent=this_->current; + b_item->children=this_->clipboard->children; - //check, if we need to add a trailing "/" to path - if (path[strlen(path)-1]!='/') { - fullLabel=g_strjoin(NULL,path,"/",this_->clipboard->label,NULL); - } else { - fullLabel=g_strjoin(NULL,path,this_->clipboard->label,NULL); - } + g_hash_table_insert(this_->bookmarks_hash,b_item->label,b_item); + this_->bookmarks_list=g_list_append(this_->bookmarks_list,b_item); + this_->current->children=g_list_append(this_->current->children,b_item); + this_->current->children=g_list_first(this_->current->children); - pc.x=this_->clipboard->c.x; - pc.y=this_->clipboard->c.y; - pc.pro=projection_mg; //Bookmarks are always stored in mg + result=bookmarks_store_bookmarks_to_file(this_,0,0); - result=bookmarks_add_bookmark(this_,&pc,fullLabel); - - g_free(fullLabel); + callback_list_call_attr_0(this_->attr_cbl, attr_bookmark_map); + bookmarks_clear_hash(this_); + bookmarks_load_hash(this_); return result; } |