diff options
author | mcapdeville <m.capdeville@no-log.org> | 2017-04-19 19:08:07 +0200 |
---|---|---|
committer | Pierre GRANDIN <pgrandin@users.noreply.github.com> | 2017-04-19 10:08:07 -0700 |
commit | 75b0417925e9b74878659e459ee8d27d0f0f5dc2 (patch) | |
tree | 5787dcc866a230ae1ac26144514701bf521c6a46 /navit/gui/internal/gui_internal.c | |
parent | 6c7688b74364681bcaf034be15ae039cbf72c50b (diff) | |
download | navit-75b0417925e9b74878659e459ee8d27d0f0f5dc2.tar.gz |
keep active vehicle profile when deactivating vehicle (#217)R7393
When deactivating vehicle, profile is choosen from "car" vehicle_profile or by
default the first vehicle_profile in list. So, by example,
car_avoid_tolls never work when manually selecting current position (and
deactivate vehicle).
Now, if there is a selected vehicle profile, we keep it as
vehicle_profile (not changing it).
Aditionnaly, in internal gui, selecting a vehicle profile when wehicle
is deactivated, in gui_internal_cmd_set_active_profile(), call navit_set_vehicleprofile_name() with new
vehicle_profile (by name) before setting vehicle_attr to NULL (like in
gui_internal_cmd_set_position()).
Now, we can switch profile when vehicle is deactivatied and route is
update correctly.
TO DO : Same in other gui
TO TEST : with more than one vehicle enable
Diffstat (limited to 'navit/gui/internal/gui_internal.c')
-rw-r--r-- | navit/gui/internal/gui_internal.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index 908b2756f..0a62ae010 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -2042,6 +2042,7 @@ gui_internal_cmd_set_active_profile(struct gui_priv *this, struct struct attr vehicle_name_attr; char *vehicle_name = NULL; struct attr profilename_attr; + struct attr vehicle; // Get the vehicle name vehicle_get_attr(v, attr_name, &vehicle_name_attr, NULL); @@ -2057,15 +2058,23 @@ gui_internal_cmd_set_active_profile(struct gui_priv *this, struct dbg(lvl_error, "Unable to set the vehicle's profile name\n"); } + navit_set_vehicleprofile_name(this->nav,profilename); + + save_vehicle_xml(v); + // Notify Navit that the routing should be re-done if this is the // active vehicle. if (gui_internal_is_active_vehicle(this, v)) { - struct attr vehicle; - vehicle.type=attr_vehicle; vehicle.u.vehicle=v; - navit_set_attr(this->nav, &vehicle); } - save_vehicle_xml(v); + else { + + vehicle.u.vehicle=NULL; + } + + vehicle.type=attr_vehicle; + navit_set_attr(this->nav, &vehicle); + gui_internal_prune_menu_count(this, 1, 0); gui_internal_menu_vehicle_settings(this, v, vehicle_name); |