From: Kaj-Michael Lang Date: Thu, 20 Sep 2007 10:54:25 +0000 (+0300) Subject: Disable menu/toolbar options when needed. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e39ecc1b7e9196e53fce68acc912a8cbf3c93aa0;p=mapper Disable menu/toolbar options when needed. --- diff --git a/src/cb.c b/src/cb.c index df75b77..23946c6 100644 --- a/src/cb.c +++ b/src/cb.c @@ -486,11 +486,15 @@ if ((_enable_gps = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))) { set_conn_state(RCVR_OFF); rcvr_disconnect(); track_add(0, FALSE); - _speed_excess = FALSE; + _speed_excess=FALSE; } +set_action_sensitive("gps_details", _enable_gps); +set_action_sensitive("goto_gps", _enable_gps); +set_action_sensitive("autocenter_latlon", _enable_gps); +set_action_sensitive("autocenter_lead", _enable_gps); + map_move_mark(); gps_show_info(); -set_action_sensitive("gps_details", _enable_gps); return TRUE; } diff --git a/src/ui-common.c b/src/ui-common.c index c542f20..63c2dfc 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -263,6 +263,7 @@ void set_action_sensitive(const char *name, gboolean sensitive) { GtkAction *action = gtk_action_group_get_action(actions, name); +g_assert(action); gtk_action_set_sensitive(action, sensitive); } @@ -270,6 +271,7 @@ void set_action_activate(const char *name, gboolean active) { GtkAction *action = gtk_action_group_get_action(actions, name); +g_assert(action); gtk_toggle_action_set_active(action, active); } @@ -849,8 +851,14 @@ memset(&_autoroute_data, 0, sizeof(_autoroute_data)); /* Set defaults for items */ set_action_activate("map_auto_download", _auto_download); -set_action_activate("enable_gps", _enable_gps); +set_action_activate("gps_enabled", _enable_gps); +set_action_sensitive("goto_gps", _enable_gps); + +set_action_sensitive("autocenter_latlon", _enable_gps); +set_action_sensitive("autocenter_lead", _enable_gps); + set_action_activate("gps_information", _gps_info); + set_action_activate("view_scale", _show_scale); set_action_activate("view_vector", _show_velvec); set_action_activate("view_poi", _show_poi);