diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-09-02 11:46:09 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-09-02 11:46:09 +0000 |
commit | 03d18c5cff8f0f2f5fe1ce6801a9fd661e12377e (patch) | |
tree | c2862592d61f8471400feba65109ba96d29dc7e1 /navit/vehicle.c | |
parent | dae43630c661a51f717ebba54966db96f3c573e0 (diff) | |
download | navit-svn-03d18c5cff8f0f2f5fe1ce6801a9fd661e12377e.tar.gz |
Add:Core:Support for removing maps and vehicle logs dynamically
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3548 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/vehicle.c')
-rw-r--r-- | navit/vehicle.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/navit/vehicle.c b/navit/vehicle.c index 86f92cc1..d25c7482 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -59,6 +59,7 @@ struct vehicle { int angle; int speed; int sequence; + GHashTable *log_to_cb; }; static void vehicle_draw_do(struct vehicle *this_, int lazy); @@ -124,6 +125,7 @@ vehicle_new(struct attr *parent, struct attr **attrs) transform_setup(this_->trans, ¢er, 16, 0); dbg(1, "leave\n"); + this_->log_to_cb=g_hash_table_new(NULL,NULL); return this_; } @@ -253,10 +255,18 @@ vehicle_add_attr(struct vehicle *this_, struct attr *attr) int vehicle_remove_attr(struct vehicle *this_, struct attr *attr) { + struct callback *cb; switch (attr->type) { case attr_callback: callback_list_remove(this_->cbl, attr->u.callback); break; + case attr_log: + cb=g_hash_table_lookup(this_->log_to_cb, attr->u.log); + if (!cb) + return 0; + g_hash_table_remove(this_->log_to_cb, attr->u.log); + callback_list_remove(this_->cbl, cb); + break; default: this_->attrs=attr_generic_remove_attr(this_->attrs, attr); return 0; @@ -598,6 +608,7 @@ vehicle_add_log(struct vehicle *this_, struct log *log) cb=callback_new_attr_2(callback_cast(vehicle_log_binfile), attr_position_coord_geo, this_, log); } else return 1; + g_hash_table_insert(this_->log_to_cb, log, cb); callback_list_add(this_->cbl, cb); return 0; } |