From ee59b67eb8b2efaa790bf00c59bdc7f748affd6a Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 16 Oct 2007 13:53:00 +0300 Subject: [PATCH] Use map goto helpers --- src/cb.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/cb.c b/src/cb.c index 94ebbc3..e234428 100644 --- a/src/cb.c +++ b/src/cb.c @@ -222,6 +222,7 @@ switch (value) { MACRO_BANNER_SHOW_INFO(_window, _("Auto-Center Mode: Lat/Lon")); break; case CENTER_MANUAL: + default: _center_mode = -_center_mode; MACRO_BANNER_SHOW_INFO(_window, _("Auto-Center Off")); return TRUE; @@ -313,43 +314,29 @@ return TRUE; } gboolean -menu_cb_goto_home(GtkAction * action) +menu_cb_goto_home(GtkAction *action) { -guint unitx, unity; - -if (_home.valid==FALSE) { +if (map_goto_position(&_home)==FALSE) { MACRO_BANNER_SHOW_INFO(_window, _("Home not set.")); - return TRUE; +} else { + MACRO_BANNER_SHOW_INFO(_window, _("At home location")); } -_center_mode = CENTER_MANUAL; -latlon2unit(_home.lat, _home.lon, unitx, unity); -map_center_unit(unitx, unity); -map_set_autozoom(FALSE); -map_update_location_from_center(); -MACRO_BANNER_SHOW_INFO(_window, _("At home location")); return TRUE; } gboolean menu_cb_goto_destination(GtkAction *action) { -guint unitx, unity; - -if (_dest.valid==FALSE) { +if (map_goto_position(&_dest)==FALSE) { MACRO_BANNER_SHOW_INFO(_window, _("Destination not set.")); - return TRUE; +} else { + MACRO_BANNER_SHOW_INFO(_window, _("At destination")); } -_center_mode = CENTER_MANUAL; -latlon2unit(_dest.lat, _dest.lon, unitx, unity); -map_center_unit(unitx, unity); -map_set_autozoom(FALSE); -map_update_location_from_center(); -MACRO_BANNER_SHOW_INFO(_window, _("At destination")); return TRUE; } gboolean -menu_cb_goto_gps(GtkAction * action) +menu_cb_goto_gps(GtkAction *action) { _center_mode = CENTER_LATLON; map_center_unit(_pos.unitx, _pos.unity); -- 2.39.5