+/**
+ * datasource_gps_setup:
+ * @dialog: The GTK dialog. The caller is responsible for managing the dialog creation/deletion
+ * @xfer: The default type of items enabled for transfer, others disabled.
+ * @xfer_all: When specified all items are enabled for transfer.
+ *
+ * Returns: A gpointer to the private structure for GPS progress/information widgets
+ * Pass this pointer back into the other exposed datasource_gps_X functions
+ */
+gpointer datasource_gps_setup ( GtkWidget *dialog, vik_gps_xfer_type xfer, gboolean xfer_all )
+{
+ gps_user_data_t *w_gps = (gps_user_data_t *)datasource_gps_init_func ( NULL );
+ w_gps->direction = GPS_UP;
+ datasource_gps_add_setup_widgets ( dialog, NULL, w_gps );
+
+ gboolean way = xfer_all;
+ gboolean trk = xfer_all;
+ gboolean rte = xfer_all;
+
+ // Selectively turn bits on
+ if ( !xfer_all ) {
+ switch (xfer) {
+ case WPT: way = TRUE; break;
+ case RTE: rte = TRUE; break;
+ default: trk = TRUE; break;
+ }
+ }
+
+ // Apply
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(w_gps->get_tracks_b), trk );
+ gtk_widget_set_sensitive ( GTK_WIDGET(w_gps->get_tracks_l), trk );
+ gtk_widget_set_sensitive ( GTK_WIDGET(w_gps->get_tracks_b), trk );
+
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(w_gps->get_routes_b), rte );
+ gtk_widget_set_sensitive ( GTK_WIDGET(w_gps->get_routes_l), rte );
+ gtk_widget_set_sensitive ( GTK_WIDGET(w_gps->get_routes_b), rte );
+
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(w_gps->get_waypoints_b), way );
+ gtk_widget_set_sensitive ( GTK_WIDGET(w_gps->get_waypoints_l), way );
+ gtk_widget_set_sensitive ( GTK_WIDGET(w_gps->get_waypoints_b), way );
+
+ return (gpointer)w_gps;
+}
+