]> err.no Git - mapper/commitdiff
Disable menu/toolbar options when needed.
authorKaj-Michael Lang <milang@onion.tal.org>
Thu, 20 Sep 2007 10:54:25 +0000 (13:54 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Thu, 20 Sep 2007 10:54:25 +0000 (13:54 +0300)
src/cb.c
src/ui-common.c

index df75b7744be8e2a6cd15c4d3b595fbe0e64bfaf3..23946c6585117974474a8d462b18bb2398f65774 100644 (file)
--- 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;
 }
index c542f20503097a4bb512853cf9f993bde50058de..63c2dfcab44bbabfb12ca3059b4031da1d6648df 100644 (file)
@@ -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);