#include "db.h"
#include "bluetooth-scan.h"
#include "hildon-wrappers.h"
-
#include "help.h"
+#include "osm-db.h"
+#include "settings-gui.h"
+
+typedef struct _KeysDialogInfo KeysDialogInfo;
+struct _KeysDialogInfo {
+ GtkWidget *cmb[CUSTOM_KEY_ENUM_COUNT];
+};
+
+#define UPDATE_GC(gc) gdk_gc_set_line_attributes(gc, _draw_width, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
-#define UPDATE_GC(gc) \
- gdk_gc_set_line_attributes(gc, _draw_width, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
void
update_gcs(void)
{
- gint i;
-
- for (i = 0; i < COLORABLE_ENUM_COUNT; i++) {
- gdk_color_alloc(gtk_widget_get_colormap(_map_widget),
- &_color[i]);
- if (_gc[i])
- g_object_unref(_gc[i]);
- _gc[i] = gdk_gc_new(_map_pixmap);
- gdk_gc_set_foreground(_gc[i], &_color[i]);
- gdk_gc_set_line_attributes(_gc[i],
- _draw_width, GDK_LINE_SOLID,
- GDK_CAP_ROUND, GDK_JOIN_ROUND);
- }
+gint i;
+
+for (i = 0; i < COLORABLE_ENUM_COUNT; i++) {
+ gdk_color_alloc(gtk_widget_get_colormap(_map_widget),&_color[i]);
+ if (_gc[i])
+ g_object_unref(_gc[i]);
+ _gc[i] = gdk_gc_new(_map_pixmap);
+ gdk_gc_set_foreground(_gc[i], &_color[i]);
+ gdk_gc_set_line_attributes(_gc[i], _draw_width, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
+}
}
static gboolean
settings_dialog_browse_forfile(GtkWidget * widget, BrowseInfo * browse_info)
{
- GtkWidget *dialog;
- gint res;
+GtkWidget *dialog;
+gint res;
- dialog = GTK_WIDGET(hildon_file_chooser_dialog_new(GTK_WINDOW(browse_info->dialog),
- GTK_FILE_CHOOSER_ACTION_OPEN));
+dialog = GTK_WIDGET(hildon_file_chooser_dialog_new(GTK_WINDOW(browse_info->dialog),GTK_FILE_CHOOSER_ACTION_OPEN));
- gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), TRUE);
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
- gtk_entry_get_text(GTK_ENTRY(browse_info->txt)));
+gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), TRUE);
+gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), gtk_entry_get_text(GTK_ENTRY(browse_info->txt)));
- res=gtk_dialog_run(GTK_DIALOG(dialog));
- if (res==GTK_RESPONSE_OK || res==GTK_RESPONSE_ACCEPT) {
- gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- gtk_entry_set_text(GTK_ENTRY(browse_info->txt), filename);
- g_free(filename);
- }
+res=gtk_dialog_run(GTK_DIALOG(dialog));
+if (res==GTK_RESPONSE_OK || res==GTK_RESPONSE_ACCEPT) {
+ gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+ gtk_entry_set_text(GTK_ENTRY(browse_info->txt), filename);
+ g_free(filename);
+}
- gtk_widget_destroy(dialog);
+gtk_widget_destroy(dialog);
- return TRUE;
+return TRUE;
}
-typedef struct _KeysDialogInfo KeysDialogInfo;
-struct _KeysDialogInfo {
- GtkWidget *cmb[CUSTOM_KEY_ENUM_COUNT];
-};
-
static gboolean
settings_dialog_hardkeys_reset(GtkWidget * widget, KeysDialogInfo * cdi)
{
GtkWidget *confirm;
-confirm = hildon_note_new_confirmation(GTK_WINDOW(_window),
- _("Reset all hardware keys to their original defaults?"));
+confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Reset all hardware keys to their original defaults?"));
if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) {
gint i;
static gboolean
settings_dialog_hardkeys(GtkWidget * widget, GtkWidget * parent)
{
- gint i;
- GtkWidget *dialog;
- GtkWidget *table;
- GtkWidget *label;
- KeysDialogInfo bdi;
- GtkWidget *btn_defaults;
-
- dialog = gtk_dialog_new_with_buttons(_("Hardware Keys"),
- GTK_WINDOW(parent),
- GTK_DIALOG_MODAL, GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT, NULL);
-
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
- btn_defaults = gtk_button_new_with_label(_("Reset...")));
- g_signal_connect(G_OBJECT(btn_defaults), "clicked",
- G_CALLBACK(settings_dialog_hardkeys_reset), &bdi);
-
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
-
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
- table = gtk_table_new(2, 9, FALSE), TRUE, TRUE, 0);
-
- for (i = 0; i < CUSTOM_KEY_ENUM_COUNT; i++) {
- gint j;
- gtk_table_attach(GTK_TABLE(table),
- label = gtk_label_new(""),
- 0, 1, i, i + 1, GTK_FILL, 0, 2, 1);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gint i;
+GtkWidget *dialog;
+GtkWidget *table;
+GtkWidget *label;
+KeysDialogInfo bdi;
+GtkWidget *btn_defaults;
+
+dialog = gtk_dialog_new_with_buttons(_("Hardware Keys"),
+ GTK_WINDOW(parent),
+ GTK_DIALOG_MODAL, GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT, NULL);
+
+gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), btn_defaults = gtk_button_new_with_label(_("Reset...")));
+g_signal_connect(G_OBJECT(btn_defaults), "clicked", G_CALLBACK(settings_dialog_hardkeys_reset), &bdi);
+
+gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table = gtk_table_new(2, 9, FALSE), TRUE, TRUE, 0);
+
+for (i = 0; i < CUSTOM_KEY_ENUM_COUNT; i++) {
+ gint j;
+ gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(""), 0, 1, i, i + 1, GTK_FILL, 0, 2, 1);
+ gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
#ifdef WITH_HILDON
- gtk_label_set_markup(GTK_LABEL(label), CUSTOM_KEY_ICON[i]);
+ gtk_label_set_markup(GTK_LABEL(label), CUSTOM_KEY_ICON[i]);
#endif
- gtk_table_attach(GTK_TABLE(table),
- bdi.cmb[i] = gtk_combo_box_new_text(),
- 1, 2, i, i + 1, GTK_FILL, 0, 2, 1);
+ gtk_table_attach(GTK_TABLE(table), bdi.cmb[i] = gtk_combo_box_new_text(), 1, 2, i, i + 1, GTK_FILL, 0, 2, 1);
for (j = 0; j < CUSTOM_ACTION_ENUM_COUNT; j++)
- gtk_combo_box_append_text(GTK_COMBO_BOX(bdi.cmb[i]),
- CUSTOM_ACTION_TEXT[j]);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(bdi.cmb[i]), CUSTOM_ACTION_TEXT[j]);
gtk_combo_box_set_active(GTK_COMBO_BOX(bdi.cmb[i]), _action[i]);
- }
+}
- gtk_widget_show_all(dialog);
-
- OUTER_WHILE:
- while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
- /* Check for duplicates. */
- for (i = 0; i < CUSTOM_KEY_ENUM_COUNT; i++) {
- gint j;
- for (j = i + 1; j < CUSTOM_KEY_ENUM_COUNT; j++) {
- if (gtk_combo_box_get_active(GTK_COMBO_BOX(bdi.cmb[i]))
- == gtk_combo_box_get_active(GTK_COMBO_BOX(bdi.cmb[j]))) {
- GtkWidget *confirm;
- gchar *buffer =
- g_strdup_printf("%s:\n %s\n%s",
- _("The following action is mapped to multiple keys"),
- CUSTOM_ACTION_TEXT
- [gtk_combo_box_get_active
- (GTK_COMBO_BOX
- (bdi.cmb[i]))],
- _("Continue?"));
- confirm =
- hildon_note_new_confirmation
- (GTK_WINDOW(_window), buffer);
-
- if (GTK_RESPONSE_OK !=
- gtk_dialog_run(GTK_DIALOG(confirm)))
- {
- gtk_widget_destroy(confirm);
- goto OUTER_WHILE;
- }
+gtk_widget_show_all(dialog);
+
+OUTER_WHILE:
+while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
+ /* Check for duplicates. */
+ for (i = 0; i < CUSTOM_KEY_ENUM_COUNT; i++) {
+ gint j;
+ for (j = i + 1; j < CUSTOM_KEY_ENUM_COUNT; j++) {
+ if (gtk_combo_box_get_active(GTK_COMBO_BOX(bdi.cmb[i])) == gtk_combo_box_get_active(GTK_COMBO_BOX(bdi.cmb[j]))) {
+ GtkWidget *confirm;
+ gchar *buffer = g_strdup_printf("%s:\n %s\n%s", _("The following action is mapped to multiple keys"),
+ CUSTOM_ACTION_TEXT[gtk_combo_box_get_active(GTK_COMBO_BOX(bdi.cmb[i]))], _("Continue?"));
+ confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), buffer);
+
+ if (GTK_RESPONSE_OK != gtk_dialog_run(GTK_DIALOG(confirm)))
+ {
gtk_widget_destroy(confirm);
+ goto OUTER_WHILE;
}
+ gtk_widget_destroy(confirm);
}
}
- for (i = 0; i < CUSTOM_KEY_ENUM_COUNT; i++)
- _action[i] =
- gtk_combo_box_get_active(GTK_COMBO_BOX(bdi.cmb[i]));
- break;
}
+ for (i = 0; i < CUSTOM_KEY_ENUM_COUNT; i++)
+ _action[i] = gtk_combo_box_get_active(GTK_COMBO_BOX(bdi.cmb[i]));
+ break;
+}
- gtk_widget_destroy(dialog);
+gtk_widget_destroy(dialog);
- return TRUE;
+return TRUE;
}
typedef struct _ColorsDialogInfo ColorsDialogInfo;
gint i;
for (i = 0; i < COLORABLE_ENUM_COUNT; i++) {
gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi->col[i]),
- &COLORABLE_DEFAULT[i]);
- }
+ (cdi->col[i]), &COLORABLE_DEFAULT[i]);
}
- gtk_widget_destroy(confirm);
+}
+gtk_widget_destroy(confirm);
- return TRUE;
+return TRUE;
}
static gboolean
settings_dialog_colors(GtkWidget * widget, GtkWidget * parent)
{
- GtkWidget *dialog;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *btn_defaults;
- ColorsDialogInfo cdi;
-
- dialog = gtk_dialog_new_with_buttons(_("Colors"),
- GTK_WINDOW(parent),
- GTK_DIALOG_MODAL, GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT, NULL);
-
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
- btn_defaults = gtk_button_new_with_label(_("Reset...")));
- g_signal_connect(G_OBJECT(btn_defaults), "clicked",
- G_CALLBACK(settings_dialog_colors_reset), &cdi);
-
- gtk_dialog_add_button(GTK_DIALOG(dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
-
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
- table = gtk_table_new(4, 3, TRUE), TRUE, TRUE, 0);
-
- /* GPS. */
- gtk_table_attach(GTK_TABLE(table),
- label = gtk_label_new(_("GPS")),
- 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table),
- cdi.col[COLORABLE_MARK] = gtk_color_button_new(),
- 1, 2, 0, 1, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_MARK]),
- &_color[COLORABLE_MARK]);
- gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_MARK_VELOCITY] =
- gtk_color_button_new(), 2, 3, 0, 1, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_MARK_VELOCITY]),
- &_color[COLORABLE_MARK_VELOCITY]);
- gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_MARK_OLD] =
- gtk_color_button_new(), 3, 4, 0, 1, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_MARK_OLD]),
- &_color[COLORABLE_MARK_OLD]);
-
- /* Track. */
- gtk_table_attach(GTK_TABLE(table),
- label = gtk_label_new(_("Track")),
- 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table),
- cdi.col[COLORABLE_TRACK] = gtk_color_button_new(),
- 1, 2, 1, 2, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_TRACK]),
- &_color[COLORABLE_TRACK]);
- gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_TRACK_MARK] =
- gtk_color_button_new(), 2, 3, 1, 2, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_TRACK_MARK]),
- &_color[COLORABLE_TRACK_MARK]);
- gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_TRACK_BREAK] =
- gtk_color_button_new(), 3, 4, 1, 2, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_TRACK_BREAK]),
- &_color[COLORABLE_TRACK_BREAK]);
-
- /* Route. */
- gtk_table_attach(GTK_TABLE(table),
- label = gtk_label_new(_("Route")),
- 0, 1, 2, 3, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table),
- cdi.col[COLORABLE_ROUTE] = gtk_color_button_new(),
- 1, 2, 2, 3, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_ROUTE]),
- &_color[COLORABLE_ROUTE]);
- gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_ROUTE_WAY] =
- gtk_color_button_new(), 2, 3, 2, 3, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_ROUTE_WAY]),
- &_color[COLORABLE_ROUTE_WAY]);
- gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_ROUTE_BREAK] =
- gtk_color_button_new(), 3, 4, 2, 3, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_ROUTE_BREAK]),
- &_color[COLORABLE_ROUTE_BREAK]);
-
- /* POI. */
- gtk_table_attach(GTK_TABLE(table),
- label = gtk_label_new(_("POI")),
- 0, 1, 3, 4, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table),
- cdi.col[COLORABLE_POI] = gtk_color_button_new(),
- 1, 2, 3, 4, 0, 0, 2, 4);
- gtk_color_button_set_color(GTK_COLOR_BUTTON
- (cdi.col[COLORABLE_POI]),
- &_color[COLORABLE_POI]);
-
- gtk_widget_show_all(dialog);
-
- if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK]), &_color[COLORABLE_MARK]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK_VELOCITY]), &_color[COLORABLE_MARK_VELOCITY]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK_OLD]), &_color[COLORABLE_MARK_OLD]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK]), &_color[COLORABLE_TRACK]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_MARK]), &_color[COLORABLE_TRACK_MARK]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_BREAK]),&_color[COLORABLE_TRACK_BREAK]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE]),&_color[COLORABLE_ROUTE]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_WAY]),&_color[COLORABLE_ROUTE_WAY]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_BREAK]),&_color[COLORABLE_ROUTE_BREAK]);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_POI]),&_color[COLORABLE_POI]);
-
- update_gcs();
+GtkWidget *dialog;
+GtkWidget *table;
+GtkWidget *label;
+GtkWidget *btn_defaults;
+ColorsDialogInfo cdi;
+
+dialog = gtk_dialog_new_with_buttons(_("Colors"), GTK_WINDOW(parent), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
+
+gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), btn_defaults = gtk_button_new_with_label(_("Reset...")));
+g_signal_connect(G_OBJECT(btn_defaults), "clicked", G_CALLBACK(settings_dialog_colors_reset), &cdi);
+
+gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table = gtk_table_new(4, 3, TRUE), TRUE, TRUE, 0);
+
+/* GPS. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("GPS")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_MARK] = gtk_color_button_new(), 1, 2, 0, 1, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK]), &_color[COLORABLE_MARK]);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_MARK_VELOCITY] = gtk_color_button_new(), 2, 3, 0, 1, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK_VELOCITY]), &_color[COLORABLE_MARK_VELOCITY]);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_MARK_OLD] = gtk_color_button_new(), 3, 4, 0, 1, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK_OLD]), &_color[COLORABLE_MARK_OLD]);
+
+/* Track. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Track")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_TRACK] = gtk_color_button_new(), 1, 2, 1, 2, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK]), &_color[COLORABLE_TRACK]);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_TRACK_MARK] = gtk_color_button_new(), 2, 3, 1, 2, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_MARK]), &_color[COLORABLE_TRACK_MARK]);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_TRACK_BREAK] = gtk_color_button_new(), 3, 4, 1, 2, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_BREAK]), &_color[COLORABLE_TRACK_BREAK]);
+
+/* Route. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Route")), 0, 1, 2, 3, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_ROUTE] = gtk_color_button_new(), 1, 2, 2, 3, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE]), &_color[COLORABLE_ROUTE]);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_ROUTE_WAY] = gtk_color_button_new(), 2, 3, 2, 3, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_WAY]), &_color[COLORABLE_ROUTE_WAY]);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_ROUTE_BREAK] = gtk_color_button_new(), 3, 4, 2, 3, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_BREAK]), &_color[COLORABLE_ROUTE_BREAK]);
+
+/* POI. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("POI")), 0, 1, 3, 4, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), cdi.col[COLORABLE_POI] = gtk_color_button_new(), 1, 2, 3, 4, 0, 0, 2, 4);
+gtk_color_button_set_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_POI]), &_color[COLORABLE_POI]);
+
+gtk_widget_show_all(dialog);
+if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK]), &_color[COLORABLE_MARK]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK_VELOCITY]), &_color[COLORABLE_MARK_VELOCITY]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_MARK_OLD]), &_color[COLORABLE_MARK_OLD]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK]), &_color[COLORABLE_TRACK]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_MARK]), &_color[COLORABLE_TRACK_MARK]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_BREAK]),&_color[COLORABLE_TRACK_BREAK]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE]),&_color[COLORABLE_ROUTE]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_WAY]),&_color[COLORABLE_ROUTE_WAY]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_BREAK]),&_color[COLORABLE_ROUTE_BREAK]);
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(cdi.col[COLORABLE_POI]),&_color[COLORABLE_POI]);
+ update_gcs();
+}
+
+gtk_widget_destroy(dialog);
+
+return TRUE;
+}
+
+gboolean
+settings_dialog_gps(void)
+{
+GtkWidget *dialog;
+GtkWidget *notebook;
+GtkWidget *table;
+GtkWidget *hbox;
+GtkWidget *label;
+GtkWidget *txt_rcvr_mac;
+GtkWidget *btn_scan;
+ScanInfo scan_info = { 0 };
+gboolean rcvr_changed=TRUE;
+
+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);
+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")));
+
+/* Receiver MAC Address. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("MAC")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+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);
+
+/* Connect signals. */
+scan_info.settings_dialog = dialog;
+scan_info.txt_rcvr_mac = txt_rcvr_mac;
+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_widget_show_all(dialog);
+
+if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
+ /* Set _rcvr_mac if necessary. */
+ if (!*gtk_entry_get_text(GTK_ENTRY(txt_rcvr_mac))) {
+ /* User specified no rcvr mac - set _rcvr_mac to NULL. */
+ if (_gps->io.address) {
+ g_free(_gps->io.address);
+ _gps->io.address=NULL;
+ rcvr_changed=TRUE;
+ set_action_sensitive("gps_details", FALSE);
+ }
+ if (_enable_gps) {
+ set_action_activate("gps_details", FALSE);
+ popup_error(dialog, _("No GPS Receiver MAC provided.\nGPS will be disabled."));
+ rcvr_changed=TRUE;
+ set_action_sensitive("gps_details", FALSE);
+ }
+ } else if (!_gps->io.address || strcmp(_gps->io.address, gtk_entry_get_text(GTK_ENTRY(txt_rcvr_mac)))) {
+ /* User specified a new rcvr mac. */
+ g_free(_gps->io.address);
+ _gps->io.address=g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_rcvr_mac)));
+ rcvr_changed=TRUE;
}
- gtk_widget_destroy(dialog);
+ /* Sensitize menus based on whether we have a database conn. */
+ gtk_widget_set_sensitive(_cmenu_loc_add_poi, _db != NULL);
+ gtk_widget_set_sensitive(_cmenu_way_add_poi, _db != NULL);
+ gtk_widget_set_sensitive(_cmenu_poi, _db != NULL);
- return TRUE;
+ config_save();
+}
+gtk_widget_destroy(dialog);
+return rcvr_changed;
+}
+
+gboolean
+settings_dialog_osm(void)
+{
+GtkWidget *dialog;
+GtkWidget *notebook;
+GtkWidget *table;
+GtkWidget *hbox;
+GtkWidget *label;
+GtkWidget *txt_mapper_db;
+GtkWidget *btn_browsedb;
+BrowseInfo browse_info = { 0, 0 };
+
+dialog = gtk_dialog_new_with_buttons(_("OSM Settings"), GTK_WINDOW(_window), GTK_DIALOG_MODAL,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
+help_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_SETTINGS_OSM);
+
+gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook = gtk_notebook_new(), TRUE, TRUE, 0);
+
+/* Database page */
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Database")));
+
+/* Database. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Database")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
+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, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+gtk_box_pack_start(GTK_BOX(hbox), txt_mapper_db = gtk_entry_new(), TRUE, TRUE, 0);
+gtk_box_pack_start(GTK_BOX(hbox), btn_browsedb = gtk_button_new_with_label(_("Browse...")), FALSE, FALSE, 0);
+
+gtk_entry_set_text(GTK_ENTRY(txt_mapper_db), _mapper_db ? _mapper_db : "");
+
+browse_info.dialog = dialog;
+browse_info.txt = txt_mapper_db;
+g_signal_connect(G_OBJECT(btn_browsedb), "clicked", G_CALLBACK(settings_dialog_browse_forfile), &browse_info);
+
+gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 300);
+gtk_widget_show_all(dialog);
+
+if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
+ if (_db) {
+ poi_deinit(_db);
+ osm_deinit();
+ db_close(&_db);
+ _db=NULL;
+ }
+ g_free(_mapper_db);
+ if (strlen(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)))>0) {
+ _mapper_db=g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)));
+ db_connect(&_db, _mapper_db);
+ poi_init(&_db);
+ osm_init(&_db);
+ } else {
+ _mapper_db=NULL;
+ }
+ /* Sensitize menus based on whether we have a database conn. */
+ gtk_widget_set_sensitive(_cmenu_loc_add_poi, _db != NULL);
+ gtk_widget_set_sensitive(_cmenu_way_add_poi, _db != NULL);
+ gtk_widget_set_sensitive(_cmenu_poi, _db != NULL);
+
+ config_save();
+}
+gtk_widget_destroy(dialog);
+return TRUE;
}
/**
gboolean
settings_dialog(void)
{
- GtkWidget *dialog;
- GtkWidget *notebook;
- GtkWidget *table;
- GtkWidget *hbox;
- GtkWidget *hbox2;
- GtkWidget *label;
- GtkWidget *txt_rcvr_mac;
- GtkWidget *num_center_ratio;
- GtkWidget *num_lead_ratio;
- GtkWidget *num_announce_notice;
- GtkWidget *chk_enable_voice;
- GtkWidget *num_voice_speed;
- GtkWidget *num_voice_pitch;
- GtkWidget *lbl_voice_speed;
- GtkWidget *lbl_voice_pitch;
- GtkWidget *num_draw_width;
- GtkWidget *chk_always_keep_on;
- GtkWidget *cmb_units;
- GtkWidget *cmb_degformat;
- GtkWidget *btn_scan;
- GtkWidget *btn_buttons;
- GtkWidget *btn_colors;
-
- GtkWidget *txt_mapper_db;
- GtkWidget *btn_browsedb;
- GtkWidget *num_poi_zoom;
- GtkWidget *chk_speed_on;
- GtkWidget *num_speed;
- GtkWidget *cmb_info_font_size;
-
- BrowseInfo browse_info = { 0, 0 };
- ScanInfo scan_info = { 0 };
- gboolean rcvr_changed = FALSE;
- guint i;
-
- dialog = gtk_dialog_new_with_buttons(_("Settings"),
- GTK_WINDOW(_window),
- GTK_DIALOG_MODAL, GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT, NULL);
-
- help_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_SETTINGS);
+GtkWidget *dialog;
+GtkWidget *notebook;
+GtkWidget *table;
+GtkWidget *hbox;
+GtkWidget *hbox2;
+GtkWidget *label;
+GtkWidget *num_center_ratio;
+GtkWidget *num_lead_ratio;
+GtkWidget *num_announce_notice;
+GtkWidget *chk_enable_voice;
+GtkWidget *num_voice_speed;
+GtkWidget *num_voice_pitch;
+GtkWidget *lbl_voice_speed;
+GtkWidget *lbl_voice_pitch;
+GtkWidget *num_draw_width;
+GtkWidget *chk_always_keep_on;
+GtkWidget *cmb_units;
+GtkWidget *cmb_degformat;
+GtkWidget *btn_buttons;
+GtkWidget *btn_colors;
+GtkWidget *num_poi_zoom;
+GtkWidget *chk_speed_on;
+GtkWidget *num_speed;
+GtkWidget *cmb_info_font_size;
+guint i;
+
+dialog = gtk_dialog_new_with_buttons(_("Settings"), GTK_WINDOW(_window), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
+help_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_SETTINGS);
#ifdef WITH_DEVICE_770
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
- btn_buttons = gtk_button_new_with_label(_("Hardware Keys...")));
- g_signal_connect(G_OBJECT(btn_buttons), "clicked", G_CALLBACK(settings_dialog_hardkeys), dialog);
+gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), btn_buttons = gtk_button_new_with_label(_("Hardware Keys...")));
+g_signal_connect(G_OBJECT(btn_buttons), "clicked", G_CALLBACK(settings_dialog_hardkeys), dialog);
#endif
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
- btn_colors = gtk_button_new_with_label(_("Colors...")));
-
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
-
- 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")));
-
- /* Receiver MAC Address. */
- gtk_table_attach(GTK_TABLE(table),
- label = gtk_label_new(_("MAC")),
- 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
- 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);
-
-
- /* Auto-Center page. */
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
- table = gtk_table_new(2, 2, FALSE),
- label = gtk_label_new(_("Auto-Center")));
-
- /* Auto-Center Sensitivity. */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Sensitivity")),
- 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), num_center_ratio = hildon_controlbar_new(),
- 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- hildon_controlbar_set_range(HILDON_CONTROLBAR(num_center_ratio), 1, 10);
- force_min_visible_bars(HILDON_CONTROLBAR(num_center_ratio), 1);
-
- /* Lead Amount. */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Lead Amount")),
- 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
-
- gtk_table_attach(GTK_TABLE(table), num_lead_ratio = hildon_controlbar_new(),
- 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- hildon_controlbar_set_range(HILDON_CONTROLBAR(num_lead_ratio), 1, 10);
- force_min_visible_bars(HILDON_CONTROLBAR(num_lead_ratio), 1);
-
- /* Announcement page */
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
- table = gtk_table_new(2, 3, FALSE),
- label = gtk_label_new(_("Announce")));
-
- /* Announcement Advance Notice. */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Advance Notice")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), num_announce_notice = hildon_controlbar_new(), 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- hildon_controlbar_set_range(HILDON_CONTROLBAR(num_announce_notice), 1, 20);
- force_min_visible_bars(HILDON_CONTROLBAR(num_announce_notice), 1);
-
- /* Enable Voice. */
- gtk_table_attach(GTK_TABLE(table),
- chk_enable_voice = gtk_check_button_new_with_label(_("Enable Voice Synthesis")),
- 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_enable_voice), _enable_voice);
-
- /* Voice Speed and Pitch. */
- gtk_table_attach(GTK_TABLE(table), hbox = gtk_hbox_new(FALSE, 12), 0, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 6);
- gtk_box_pack_start(GTK_BOX(hbox), hbox2 = gtk_hbox_new(FALSE, 4), TRUE, TRUE, 4);
- gtk_box_pack_start(GTK_BOX(hbox2), lbl_voice_speed = gtk_label_new(_("Speed (words/minute)")), TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox2), num_voice_speed = hildon_number_editor_new(80, 370), TRUE, TRUE, 0);
-
- gtk_box_pack_start(GTK_BOX(hbox), hbox2 = gtk_hbox_new(FALSE, 4), TRUE, TRUE, 4);
- gtk_box_pack_start(GTK_BOX(hbox2), lbl_voice_pitch = gtk_label_new(_("Pitch")), TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox2), num_voice_pitch = hildon_number_editor_new(1, 99), TRUE, TRUE, 0);
-
- /* Display settings page. */
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Display")));
-
- /* Line Width. */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Line Width")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), num_draw_width = hildon_controlbar_new(), 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- hildon_controlbar_set_range(HILDON_CONTROLBAR(num_draw_width), 1, 20);
- force_min_visible_bars(HILDON_CONTROLBAR(num_draw_width), 1);
-
- /* Keep Display On Only When Fullscreen. */
- gtk_table_attach(GTK_TABLE(table),
- chk_always_keep_on = gtk_check_button_new_with_label(_("Keep Display On Only in Fullscreen Mode")),
- 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
-
- /* Information Font Size. */
- gtk_table_attach(GTK_TABLE(table), hbox = gtk_hbox_new(FALSE, 4), 0, 2, 2, 3, GTK_FILL, 0, 2, 4);
- gtk_box_pack_start(GTK_BOX(hbox), label = gtk_label_new(_("Information Font Size")), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), cmb_info_font_size = gtk_combo_box_new_text(), FALSE, FALSE, 0);
- for (i = 0; i < INFO_FONT_ENUM_COUNT; i++)
- gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_info_font_size), INFO_FONT_TEXT[i]);
-
- /* Units page. */
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Units")));
-
- /* Units. */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Units")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), cmb_units = gtk_combo_box_new_text(), 1, 2, 0, 1, GTK_FILL, 0, 2, 4);
- for (i = 0; i < UNITS_ENUM_COUNT; i++)
- gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_units), UNITS_TEXT[i]);
-
- /* Degrees format */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Degrees Format")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), 1, 2, 1, 2, GTK_FILL, 0, 2, 4);
- gtk_container_add(GTK_CONTAINER(label), cmb_degformat = gtk_combo_box_new_text());
- for (i = 0; i < DEG_FORMAT_ENUM_COUNT; i++)
- gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_degformat), DEG_FORMAT_TEXT[i]);
-
- gtk_table_attach(GTK_TABLE(table), gtk_label_new(""), 2, 3, 0, 2, GTK_FILL | GTK_EXPAND, 0, 2, 4);
-
- /* Speed warner. */
- gtk_table_attach(GTK_TABLE(table), hbox = gtk_hbox_new(FALSE, 4), 0, 3, 2, 3, GTK_FILL, 0, 2, 4);
-
- gtk_box_pack_start(GTK_BOX(hbox), chk_speed_on = gtk_check_button_new_with_label(_("Display Speed")), FALSE, FALSE, 0);
-
- gtk_box_pack_start(GTK_BOX(hbox), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), FALSE, FALSE, 0);
- gtk_container_add(GTK_CONTAINER(label), num_speed = hildon_number_editor_new(0, 999));
-
- /* Database page */
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Database")));
-
- /* Database. */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Database")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
- 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, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- gtk_box_pack_start(GTK_BOX(hbox), txt_mapper_db = gtk_entry_new(), TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), btn_browsedb = gtk_button_new_with_label(_("Browse...")), FALSE, FALSE, 0);
-
- /* Show POI below zoom. */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Show POI below zoom")), 0, 1, 2, 3, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- gtk_container_add(GTK_CONTAINER(label), num_poi_zoom = hildon_number_editor_new(0, MAX_ZOOM));
-
- /* Connect signals. */
- scan_info.settings_dialog = dialog;
- scan_info.txt_rcvr_mac = txt_rcvr_mac;
- g_signal_connect(G_OBJECT(btn_scan), "clicked", G_CALLBACK(scan_bluetooth), &scan_info);
- g_signal_connect(G_OBJECT(btn_colors), "clicked", G_CALLBACK(settings_dialog_colors), dialog);
-
- browse_info.dialog = dialog;
- browse_info.txt = txt_mapper_db;
- g_signal_connect(G_OBJECT(btn_browsedb), "clicked", G_CALLBACK(settings_dialog_browse_forfile), &browse_info);
-
- /* Initialize fields. */
- gtk_entry_set_text(GTK_ENTRY(txt_rcvr_mac), _gps->io.address ? _gps->io.address : "");
- gtk_entry_set_text(GTK_ENTRY(txt_mapper_db), _mapper_db ? _mapper_db : "");
-
- hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_poi_zoom), _poi_zoom);
- hildon_controlbar_set_value(HILDON_CONTROLBAR(num_center_ratio), _center_ratio);
- hildon_controlbar_set_value(HILDON_CONTROLBAR(num_lead_ratio), _lead_ratio);
- hildon_controlbar_set_value(HILDON_CONTROLBAR(num_announce_notice), _announce_notice_ratio);
- hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_voice_speed), _voice_speed);
- hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_voice_pitch), _voice_pitch);
- hildon_controlbar_set_value(HILDON_CONTROLBAR(num_draw_width), _draw_width);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_always_keep_on), !_always_keep_on);
- gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_units), _units);
- gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_degformat), _degformat);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_speed_on), _speed_on);
- hildon_number_editor_set_range(HILDON_NUMBER_EDITOR(num_speed), 1, 300);
- hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_speed), _speed_limit);
- gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_info_font_size), _info_font_size);
-
- gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 300);
- gtk_widget_show_all(dialog);
-
- if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
- /* Set _rcvr_mac if necessary. */
- if (!*gtk_entry_get_text(GTK_ENTRY(txt_rcvr_mac))) {
- /* User specified no rcvr mac - set _rcvr_mac to NULL. */
- if (_gps->io.address) {
- g_free(_gps->io.address);
- _gps->io.address = NULL;
- rcvr_changed = TRUE;
- set_action_sensitive("gps_details", FALSE);
- }
- if (_enable_gps) {
- set_action_activate("gps_details", FALSE);
- popup_error(dialog, _("No GPS Receiver MAC provided.\nGPS will be disabled."));
- rcvr_changed = TRUE;
- set_action_sensitive("gps_details", FALSE);
- }
- } else if (!_gps->io.address || strcmp(_gps->io.address, gtk_entry_get_text(GTK_ENTRY(txt_rcvr_mac)))) {
- /* User specified a new rcvr mac. */
- g_free(_gps->io.address);
- _gps->io.address = g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_rcvr_mac)));
- rcvr_changed = TRUE;
- }
-
- _center_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_center_ratio));
- _lead_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_lead_ratio));
- _draw_width = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_draw_width));
- _always_keep_on = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_always_keep_on));
- _units = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_units));
- _degformat = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_degformat));
- _speed_on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_speed_on));
- _speed_limit = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_speed));
- _info_font_size = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_info_font_size));
-
- _announce_notice_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_announce_notice));
-
- _voice_speed = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_voice_speed));
- _voice_pitch = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_voice_pitch));
- _enable_voice = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_enable_voice));
-
- speak_set_parameters(_voice_speed, _voice_pitch);
-
- if (_db) {
- poi_deinit(_db);
- osm_deinit(_db);
- db_close(&_db);
- _db = NULL;
- }
- g_free(_mapper_db);
- if (strlen(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)))) {
- _mapper_db=g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)));
- db_connect(&_db, _mapper_db);
- poi_init(&_db);
- osm_init(&_db);
- } else {
- _mapper_db=NULL;
- }
-
- /* Sensitize menus based on whether we have a database conn. */
- gtk_widget_set_sensitive(_cmenu_loc_add_poi, _db != NULL);
- gtk_widget_set_sensitive(_cmenu_way_add_poi, _db != NULL);
- gtk_widget_set_sensitive(_cmenu_poi, _db != NULL);
-
- _poi_zoom = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_poi_zoom));
-
- update_gcs();
-
- config_save();
- }
+gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), btn_colors = gtk_button_new_with_label(_("Colors...")));
+gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook = gtk_notebook_new(), TRUE, TRUE, 0);
+
+/* Auto-Center page. */
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 2, FALSE), label = gtk_label_new(_("Auto-Center")));
+
+/* Auto-Center Sensitivity. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Sensitivity")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), num_center_ratio = hildon_controlbar_new(), 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+hildon_controlbar_set_range(HILDON_CONTROLBAR(num_center_ratio), 1, 10);
+force_min_visible_bars(HILDON_CONTROLBAR(num_center_ratio), 1);
+
+/* Lead Amount. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Lead Amount")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+
+gtk_table_attach(GTK_TABLE(table), num_lead_ratio = hildon_controlbar_new(), 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+hildon_controlbar_set_range(HILDON_CONTROLBAR(num_lead_ratio), 1, 10);
+force_min_visible_bars(HILDON_CONTROLBAR(num_lead_ratio), 1);
+
+/* Announcement page */
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Announce")));
+
+/* Announcement Advance Notice. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Advance Notice")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), num_announce_notice = hildon_controlbar_new(), 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+hildon_controlbar_set_range(HILDON_CONTROLBAR(num_announce_notice), 1, 20);
+force_min_visible_bars(HILDON_CONTROLBAR(num_announce_notice), 1);
+
+/* Enable Voice. */
+gtk_table_attach(GTK_TABLE(table), chk_enable_voice = gtk_check_button_new_with_label(_("Enable Voice Synthesis")), 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_enable_voice), _enable_voice);
+
+/* Voice Speed and Pitch. */
+gtk_table_attach(GTK_TABLE(table), hbox = gtk_hbox_new(FALSE, 12), 0, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 6);
+gtk_box_pack_start(GTK_BOX(hbox), hbox2 = gtk_hbox_new(FALSE, 4), TRUE, TRUE, 4);
+gtk_box_pack_start(GTK_BOX(hbox2), lbl_voice_speed = gtk_label_new(_("Speed (words/minute)")), TRUE, TRUE, 0);
+gtk_box_pack_start(GTK_BOX(hbox2), num_voice_speed = hildon_number_editor_new(80, 370), TRUE, TRUE, 0);
+gtk_box_pack_start(GTK_BOX(hbox), hbox2 = gtk_hbox_new(FALSE, 4), TRUE, TRUE, 4);
+gtk_box_pack_start(GTK_BOX(hbox2), lbl_voice_pitch = gtk_label_new(_("Pitch")), TRUE, TRUE, 0);
+gtk_box_pack_start(GTK_BOX(hbox2), num_voice_pitch = hildon_number_editor_new(1, 99), TRUE, TRUE, 0);
+
+/* Display settings page. */
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Display")));
+
+/* Line Width. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Line Width")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), num_draw_width = hildon_controlbar_new(), 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+hildon_controlbar_set_range(HILDON_CONTROLBAR(num_draw_width), 1, 20);
+force_min_visible_bars(HILDON_CONTROLBAR(num_draw_width), 1);
+
+/* Keep Display On Only When Fullscreen. */
+gtk_table_attach(GTK_TABLE(table), chk_always_keep_on = gtk_check_button_new_with_label(_("Keep Display On Only in Fullscreen Mode")), 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+
+/* Information Font Size. */
+gtk_table_attach(GTK_TABLE(table), hbox = gtk_hbox_new(FALSE, 4), 0, 2, 2, 3, GTK_FILL, 0, 2, 4);
+gtk_box_pack_start(GTK_BOX(hbox), label = gtk_label_new(_("Information Font Size")), FALSE, FALSE, 0);
+gtk_box_pack_start(GTK_BOX(hbox), cmb_info_font_size = gtk_combo_box_new_text(), FALSE, FALSE, 0);
+for (i = 0; i < INFO_FONT_ENUM_COUNT; i++)
+ gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_info_font_size), INFO_FONT_TEXT[i]);
+
+/* Units page. */
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Units")));
+
+/* Units. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Units")), 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), cmb_units = gtk_combo_box_new_text(), 1, 2, 0, 1, GTK_FILL, 0, 2, 4);
+for (i = 0; i < UNITS_ENUM_COUNT; i++)
+ gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_units), UNITS_TEXT[i]);
+
+/* Degrees format */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Degrees Format")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), 1, 2, 1, 2, GTK_FILL, 0, 2, 4);
+gtk_container_add(GTK_CONTAINER(label), cmb_degformat = gtk_combo_box_new_text());
+for (i = 0; i < DEG_FORMAT_ENUM_COUNT; i++)
+ gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_degformat), DEG_FORMAT_TEXT[i]);
+gtk_table_attach(GTK_TABLE(table), gtk_label_new(""), 2, 3, 0, 2, GTK_FILL | GTK_EXPAND, 0, 2, 4);
+
+/* Speed warner. */
+gtk_table_attach(GTK_TABLE(table), hbox = gtk_hbox_new(FALSE, 4), 0, 3, 2, 3, GTK_FILL, 0, 2, 4);
+gtk_box_pack_start(GTK_BOX(hbox), chk_speed_on = gtk_check_button_new_with_label(_("Display Speed")), FALSE, FALSE, 0);
+gtk_box_pack_start(GTK_BOX(hbox), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), FALSE, FALSE, 0);
+gtk_container_add(GTK_CONTAINER(label), num_speed = hildon_number_editor_new(0, 999));
+
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("POIs")));
+/* Show POI below zoom. */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Show POI below zoom")), 0, 1, 2, 3, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+gtk_container_add(GTK_CONTAINER(label), num_poi_zoom = hildon_number_editor_new(0, MAX_ZOOM));
+
+g_signal_connect(G_OBJECT(btn_colors), "clicked", G_CALLBACK(settings_dialog_colors), dialog);
+
+/* Initialize fields. */
+hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_poi_zoom), _poi_zoom);
+hildon_controlbar_set_value(HILDON_CONTROLBAR(num_center_ratio), _center_ratio);
+hildon_controlbar_set_value(HILDON_CONTROLBAR(num_lead_ratio), _lead_ratio);
+hildon_controlbar_set_value(HILDON_CONTROLBAR(num_announce_notice), _announce_notice_ratio);
+hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_voice_speed), _voice_speed);
+hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_voice_pitch), _voice_pitch);
+hildon_controlbar_set_value(HILDON_CONTROLBAR(num_draw_width), _draw_width);
+gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_always_keep_on), !_always_keep_on);
+gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_units), _units);
+gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_degformat), _degformat);
+gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_speed_on), _speed_on);
+hildon_number_editor_set_range(HILDON_NUMBER_EDITOR(num_speed), 1, 300);
+hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(num_speed), _speed_limit);
+gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_info_font_size), _info_font_size);
+
+gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 300);
+gtk_widget_show_all(dialog);
+
+if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
+ _center_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_center_ratio));
+ _lead_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_lead_ratio));
+ _draw_width = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_draw_width));
+ _always_keep_on = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_always_keep_on));
+ _units = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_units));
+ _degformat = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_degformat));
+ _speed_on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_speed_on));
+ _speed_limit = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_speed));
+ _info_font_size = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_info_font_size));
+ _announce_notice_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_announce_notice));
+ _voice_speed = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_voice_speed));
+ _voice_pitch = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_voice_pitch));
+ _enable_voice = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_enable_voice));
+ _poi_zoom = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_poi_zoom));
+
+ speak_set_parameters(_voice_speed, _voice_pitch);
+ update_gcs();
+ config_save();
+}
#ifndef WITH_HILDON
- /* Destroying causes a crash (!?!?!??!) huh? in hildon (770?) only, plain gtk is ok...*/
- gtk_widget_destroy(dialog);
+/* Destroying causes a crash (!?!?!??!) huh? in hildon (770?) only, plain gtk is ok...*/
+gtk_widget_destroy(dialog);
#else
- gtk_widget_hide(dialog);
+gtk_widget_hide(dialog);
#endif
- return rcvr_changed;
+return FALSE;
}