From: Kaj-Michael Lang Date: Thu, 10 Apr 2008 14:21:30 +0000 (+0300) Subject: Grey out Route menu entries that require a loaded route. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37f2a5a5b0d8e17605623f2575e6b25d84e5b944;p=mapper Grey out Route menu entries that require a loaded route. --- diff --git a/src/ui-common.c b/src/ui-common.c index dc818c5..f065fc9 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -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); }