#define GPSD_NMEA "r+\r\n"
#define GPSD_PORT (2947)
+const GpsTypes gps_types[] = {
+ { GPS_IO_RFCOMM, "Direct bluetooth connection", TRUE, TRUE},
+ { GPS_IO_HILDON_DBUS, "Hildon D-Bus", TRUE, TRUE },
+ { GPS_IO_BLUEZ_DBUS, "Blues D-Bus", TRUE, TRUE},
+ { GPS_IO_FILE, "File or device", FALSE, TRUE},
+ { GPS_IO_TCP, "TCP Connection", FALSE, TRUE},
+ { GPS_IO_GPSD, "GPSD", FALSE, TRUE},
+ { GPS_IO_GYPSY, "Gypsy", FALSE, TRUE},
+ { GPS_IO_SIMULATION, "Simulation", FALSE, FALSE},
+ { 0 }
+};
+
+GpsTypes *
+gps_get_supported_types(void)
+{
+return gps_types;
+}
+
/**
* Init GPS structure
*/
GtkWidget *notebook;
GtkWidget *table;
GtkWidget *hbox;
+GtkWidget *vbox;
GtkWidget *label;
+GtkWidget *cmb_gps_type;
GtkWidget *txt_rcvr_mac;
GtkWidget *btn_scan;
+GtkCellRenderer *renderer;
+GtkTreeIter active;
+GtkListStore *store;
+GtkTreeIter iter;
ScanInfo scan_info = { 0 };
gboolean rcvr_changed=TRUE;
+GpsTypes *gpstypes;
+gint i=0;
dialog = gtk_dialog_new_with_buttons(_("GPS Settings"), GTK_WINDOW(_window), GTK_DIALOG_MODAL,
- GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
help_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_SETTINGS_GPS);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook = gtk_notebook_new(), TRUE, TRUE, 0);
/* Receiver page. */
-gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("GPS")));
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox = gtk_vbox_new(FALSE, 4), label = gtk_label_new(_("GPS")));
+
+/* Type */
+hbox = gtk_hbox_new(FALSE, 3);
+gtk_box_pack_start(GTK_BOX(hbox), label = gtk_label_new(_("GPS Type")), TRUE, TRUE, 0);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_box_pack_start(GTK_BOX(hbox), cmb_gps_type = gtk_combo_box_new_with_model(GTK_TREE_MODEL(gtk_list_store_new(2, G_TYPE_INT, G_TYPE_STRING))), TRUE, FALSE, 0);
+gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
+
+/* Add GPS types */
+/* Set up the view for the combo box. */
+renderer = gtk_cell_renderer_text_new();
+gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cmb_gps_type), renderer, TRUE);
+gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(cmb_gps_type), renderer, "text", 1, NULL);
+
+store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(cmb_gps_type)));
+gtk_list_store_clear(store);
+
+gpstypes=gps_get_supported_types();
+while (gpstypes->type!=0) {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, gpstypes->type, 1, gpstypes->name, -1);
+ gpstypes++;
+}
+
+#if 0
+gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &active);
+gtk_combo_box_set_active_iter(GTK_COMBO_BOX(cmb_gps_type), &active);
+#endif
/* Receiver MAC Address. */
-gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("MAC")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+hbox = gtk_hbox_new(FALSE, 3);
+gtk_box_pack_start(GTK_BOX(hbox), label = gtk_label_new(_("Address")), TRUE, TRUE, 0);
gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
-gtk_table_attach(GTK_TABLE(table), hbox = gtk_hbox_new(FALSE, 4), 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
gtk_box_pack_start(GTK_BOX(hbox), txt_rcvr_mac = gtk_entry_new(), TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), btn_scan = gtk_button_new_with_label(_("Scan...")), FALSE, FALSE, 0);
-
-/* Note!. */
-gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Note: You can enter a device path\n""(e.g. \"/dev/rfcomm0\").")), 0, 2, 1, 2, GTK_FILL, 0, 2, 4);
-gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
-gtk_misc_set_alignment(GTK_MISC(label), 0.5f, 0.5f);
+gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
/* Connect signals. */
scan_info.settings_dialog = dialog;
g_signal_connect(G_OBJECT(btn_scan), "clicked", G_CALLBACK(scan_bluetooth), &scan_info);
gtk_entry_set_text(GTK_ENTRY(txt_rcvr_mac), _gps->io.address ? _gps->io.address : "");
-gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 300);
+gtk_window_set_default_size(GTK_WINDOW(dialog), 500, -1);
gtk_widget_show_all(dialog);
if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {