#include "map-repo.h"
#include "config-gconf.h"
-static void
+static gboolean
path_tree_view_update_store(GtkWidget *tree_view, Path *path)
{
GtkListStore *store;
+g_assert(tree_view);
+g_assert(path);
+
store=path_generate_store(path);
-if (store!=NULL) {
- gtk_tree_view_set_model(tree_view, store);
- g_object_unref(G_OBJECT(store));
-}
+if (!store)
+ return FALSE;
+
+gtk_tree_view_set_model(tree_view, store);
+g_object_unref(G_OBJECT(store));
+return TRUE;
}
+/***********************
+ Route menu callbacks
+ ***********************/
gboolean
menu_cb_route_download(GtkAction * action)
{
route_download(NULL);
-path_tree_view_update_store(route_tree_view, _route);
+route_menu_set_sensitive(path_tree_view_update_store(route_tree_view, _route));
return TRUE;
}
gboolean
-menu_cb_route_open(GtkAction * action)
+menu_cb_route_open(GtkAction *action)
{
-GtkListStore *store;
-
route_open_file();
-path_tree_view_update_store(route_tree_view, _route);
+route_menu_set_sensitive(path_tree_view_update_store(route_tree_view, _route));
+return TRUE;
+}
+
+gboolean
+menu_cb_route_save(GtkAction * action)
+{
+route_save();
return TRUE;
}
{
route_clear();
gtk_tree_view_set_model(route_tree_view, NULL);
+route_menu_set_sensitive(FALSE);
return TRUE;
}
+/***********************
+ Track menu callbacks
+ ***********************/
gboolean
menu_cb_track_open(GtkAction * action)
{
return TRUE;
}
-gboolean
-menu_cb_route_save(GtkAction * action)
-{
-route_save();
-return TRUE;
-}
-
gboolean
menu_cb_track_clear(GtkAction * action)
{
return TRUE;
}
+/***********************
+ Other menu callbacks
+ ***********************/
gboolean
menu_cb_show_tracks(GtkAction *action)
{
gps_conn_set_state(_gps, RCVR_DOWN);
gps_connect_now(_gps);
} else {
- popup_error(_window, _("Cannot enable GPS until a GPS Receiver has been configured in the GPS Settings dialog."));
+ MACRO_BANNER_SHOW_INFO(_window, _("Cannot enable GPS until a GPS Receiver has been configured in the GPS Settings dialog."));
set_action_activate("gps_enabled", FALSE);
}
} else {
gboolean
menu_cb_settings(GtkAction * action)
{
-settings_dialog();
-MACRO_RECALC_FOCUS_BASE(_center_ratio);
-MACRO_RECALC_FOCUS_SIZE(_center_ratio);
-map_force_redraw();
+if (settings_dialog()) {
+ MACRO_RECALC_FOCUS_BASE(_center_ratio);
+ MACRO_RECALC_FOCUS_SIZE(_center_ratio);
+ map_force_redraw();
+}
return TRUE;
}
gps_connect_now(_gps);
}
}
-#if 0
-MACRO_RECALC_FOCUS_BASE(_center_ratio);
-MACRO_RECALC_FOCUS_SIZE(_center_ratio);
-map_force_redraw();
-#endif
return TRUE;
}
return TRUE;
}
-
gboolean
menu_cb_help(GtkAction * action)
{