From: Kaj-Michael Lang Date: Tue, 16 Oct 2007 10:53:00 +0000 (+0300) Subject: Use map goto helpers X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee59b67eb8b2efaa790bf00c59bdc7f748affd6a;p=mapper Use map goto helpers --- 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);