]> err.no Git - mapper/commitdiff
Grey out Route menu entries that require a loaded route.
authorKaj-Michael Lang <milang@tal.org>
Thu, 10 Apr 2008 14:21:30 +0000 (17:21 +0300)
committerKaj-Michael Lang <milang@tal.org>
Thu, 10 Apr 2008 14:21:30 +0000 (17:21 +0300)
src/ui-common.c

index dc818c526573ac00029bf918139a0bed6b18f6b0..f065fc90bda057218fed5bea32bcf50e2a621742 100644 (file)
@@ -539,6 +539,19 @@ gtk_window_resize(GTK_WINDOW(window), WINDOW_SIZE_X, WINDOW_SIZE_Y);
 return window;
 }
 
+/**
+ * Set sensitivity of route menu items
+ */
+void
+route_menu_set_sensitive(gboolean s)
+{
+set_action_sensitive("route_save", s);
+set_action_sensitive("route_dist_next", s);
+set_action_sensitive("route_dist_last", s);
+set_action_sensitive("route_reset", s);
+set_action_sensitive("route_clear", s);
+}
+
 /**
  * Create a tree view inside given container
  */
@@ -652,7 +665,6 @@ gtk_container_add(GTK_CONTAINER(_window), vbox_main);
 /* Create and add widgets and supporting data. */
 gtk_box_pack_start(GTK_BOX(vbox_main), GTK_WIDGET(notebook), TRUE, TRUE, 0);
 gtk_box_pack_start(GTK_BOX(vbox_main), GTK_WIDGET(info_banner.container), FALSE, FALSE, 0);
-hildon_program_set_common_toolbar(_program, GTK_TOOLBAR(toolbar));
 {
        GtkMenu *hmenu;
        hmenu = GTK_MENU(gtk_menu_new());
@@ -660,6 +672,7 @@ hildon_program_set_common_toolbar(_program, GTK_TOOLBAR(toolbar));
        gtk_container_foreach(GTK_CONTAINER(menu_bar), (GtkCallback)gtk_widget_reparent, hmenu);
        hildon_window_set_menu(HILDON_WINDOW(_window), hmenu);
 }
+hildon_window_add_toolbar(_window, GTK_TOOLBAR(toolbar));
 gtk_widget_show_all(GTK_WIDGET(toolbar));
 #else
 _status_bar = gtk_statusbar_new();
@@ -768,15 +781,14 @@ set_action_activate("view_poi", _show_poi);
 set_action_activate("view_track", _show_tracks & TRACKS_MASK);
 set_action_activate("view_route", _show_tracks & ROUTES_MASK);
 
+route_menu_set_sensitive(FALSE);
+
+gps_show_info(&_gps->data);
+
 /* Connect signals. */
 g_signal_connect(G_OBJECT(_window), "key_press_event", G_CALLBACK(window_cb_key_press), NULL);
 g_signal_connect(G_OBJECT(_window), "key_release_event", G_CALLBACK(window_cb_key_release), NULL);
 
-/* If we have a route, calculate the next point. */
-route_find_nearest_point();
-
-gps_show_info(&_gps->data);
-
 gtk_idle_add((GSourceFunc)window_present, NULL);
 }