20 |
#include "gpxview.h" |
#include "gpxview.h" |
21 |
#include <math.h> |
#include <math.h> |
22 |
|
|
23 |
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
24 |
|
#include <hildon/hildon-check-button.h> |
25 |
|
#endif |
26 |
|
|
27 |
typedef struct { |
typedef struct { |
28 |
GtkWidget *cbox_gps; |
GtkWidget *cbox_gps; |
29 |
GtkWidget *loc; |
GtkWidget *loc; |
30 |
} settings_dialog_state_t; |
} settings_dialog_state_t; |
31 |
|
|
32 |
|
/* ------------------------ special gui elements for fremantle ------------------ */ |
33 |
|
|
34 |
|
static GtkWidget *toggle_button_new_with_label(char *label) { |
35 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
36 |
|
return gtk_check_button_new_with_label(label); |
37 |
|
#else |
38 |
|
GtkWidget *cbut = gtk_toggle_button_new_with_label(label); |
39 |
|
hildon_gtk_widget_set_theme_size(cbut, |
40 |
|
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
41 |
|
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(cbut), FALSE); |
42 |
|
return cbut; |
43 |
|
#endif |
44 |
|
} |
45 |
|
|
46 |
|
static void toggle_button_set_active(GtkWidget *button, gboolean active) { |
47 |
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); |
48 |
|
} |
49 |
|
|
50 |
|
static gboolean toggle_button_get_active(GtkWidget *button) { |
51 |
|
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); |
52 |
|
} |
53 |
|
|
54 |
|
static GtkWidget *check_button_new_with_label(char *label) { |
55 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
56 |
|
return gtk_check_button_new_with_label(label); |
57 |
|
#else |
58 |
|
GtkWidget *cbut = |
59 |
|
hildon_check_button_new(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH); |
60 |
|
gtk_button_set_label(GTK_BUTTON(cbut), label); |
61 |
|
return cbut; |
62 |
|
#endif |
63 |
|
} |
64 |
|
|
65 |
|
static void check_button_set_active(GtkWidget *button, gboolean active) { |
66 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
67 |
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); |
68 |
|
#else |
69 |
|
hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active); |
70 |
|
#endif |
71 |
|
} |
72 |
|
|
73 |
|
static gboolean check_button_get_active(GtkWidget *button) { |
74 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
75 |
|
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); |
76 |
|
#else |
77 |
|
return hildon_check_button_get_active(HILDON_CHECK_BUTTON(button)); |
78 |
|
#endif |
79 |
|
} |
80 |
|
|
81 |
/* Our usual callback function */ |
/* Our usual callback function */ |
82 |
static void settings_update(GtkWidget *widget, gpointer data) { |
static void settings_update(GtkWidget *widget, gpointer data) { |
83 |
settings_dialog_state_t *hstate = (settings_dialog_state_t *)data; |
settings_dialog_state_t *hstate = (settings_dialog_state_t *)data; |
84 |
|
|
85 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hstate->cbox_gps))) |
if(check_button_get_active(hstate->cbox_gps)) |
86 |
gtk_widget_set_sensitive(hstate->loc, FALSE); |
gtk_widget_set_sensitive(hstate->loc, FALSE); |
87 |
else |
else |
88 |
gtk_widget_set_sensitive(hstate->loc, TRUE); |
gtk_widget_set_sensitive(hstate->loc, TRUE); |
258 |
|
|
259 |
mm_context.import_button = gtk_button_new(); |
mm_context.import_button = gtk_button_new(); |
260 |
gtk_button_set_image(GTK_BUTTON(mm_context.import_button), |
gtk_button_set_image(GTK_BUTTON(mm_context.import_button), |
261 |
icon_get_widget(ICON_MISC, 5)); |
icon_get_widget(ICON_MISC, 3)); |
262 |
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), |
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), |
263 |
mm_context.import_button); |
mm_context.import_button); |
264 |
gtk_signal_connect(GTK_OBJECT(mm_context.import_button), "clicked", |
gtk_signal_connect(GTK_OBJECT(mm_context.import_button), "clicked", |
434 |
static GtkWidget *location_widget(location_context_t *context) { |
static GtkWidget *location_widget(location_context_t *context) { |
435 |
|
|
436 |
GtkWidget *vbox = gtk_vbox_new(FALSE,3); |
GtkWidget *vbox = gtk_vbox_new(FALSE,3); |
437 |
|
|
438 |
|
#ifndef USE_PANNABLE_AREA |
439 |
context->view = gtk_tree_view_new(); |
context->view = gtk_tree_view_new(); |
440 |
|
#else |
441 |
|
context->view = hildon_gtk_tree_view_new(HILDON_UI_MODE_EDIT); |
442 |
|
#endif |
443 |
|
|
444 |
gtk_tree_selection_set_select_function( |
gtk_tree_selection_set_select_function( |
445 |
gtk_tree_view_get_selection(GTK_TREE_VIEW(context->view)), |
gtk_tree_view_get_selection(GTK_TREE_VIEW(context->view)), |
509 |
|
|
510 |
g_object_unref(context->store); |
g_object_unref(context->store); |
511 |
|
|
|
#if 0 |
|
|
/* make list react on clicks */ |
|
|
g_signal_connect(context->view, "row-activated", |
|
|
(GCallback)gpxlist_view_onRowActivated, appdata); |
|
|
#endif |
|
|
|
|
512 |
/* select the "active" row */ |
/* select the "active" row */ |
513 |
location_select(context); |
location_select(context); |
514 |
|
|
515 |
/* put it into a scrolled window */ |
/* put it into a scrolled window */ |
516 |
|
#ifndef USE_PANNABLE_AREA |
517 |
GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL); |
GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL); |
518 |
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), |
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), |
519 |
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
520 |
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), |
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), |
521 |
GTK_SHADOW_ETCHED_IN); |
GTK_SHADOW_ETCHED_IN); |
|
// gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 3); |
|
522 |
gtk_container_add(GTK_CONTAINER(scrolled_window), context->view); |
gtk_container_add(GTK_CONTAINER(scrolled_window), context->view); |
523 |
gtk_box_pack_start_defaults(GTK_BOX(vbox), scrolled_window); |
gtk_box_pack_start_defaults(GTK_BOX(vbox), scrolled_window); |
524 |
|
#else |
525 |
|
/* fremantle doesn't use a pannable area here. instead the entire */ |
526 |
|
/* settings are inside one big pannable area */ |
527 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), context->view); |
528 |
|
#endif |
529 |
|
|
530 |
/* ------- button box ------------ */ |
/* ------- button box ------------ */ |
531 |
|
|
532 |
GtkWidget *hbox = gtk_hbox_new(TRUE,3); |
GtkWidget *hbox = gtk_hbox_new(TRUE,3); |
533 |
context->but_add = gtk_button_new_with_label(_("Add")); |
context->but_add = gtk_button_new_with_label(_("Add")); |
534 |
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
535 |
|
hildon_gtk_widget_set_theme_size(context->but_add, |
536 |
|
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
537 |
|
#endif |
538 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context->but_add); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context->but_add); |
539 |
gtk_signal_connect(GTK_OBJECT(context->but_add), "clicked", |
gtk_signal_connect(GTK_OBJECT(context->but_add), "clicked", |
540 |
GTK_SIGNAL_FUNC(on_location_add), context); |
GTK_SIGNAL_FUNC(on_location_add), context); |
541 |
|
|
542 |
context->but_edit = gtk_button_new_with_label(_("Edit")); |
context->but_edit = gtk_button_new_with_label(_("Edit")); |
543 |
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
544 |
|
hildon_gtk_widget_set_theme_size(context->but_edit, |
545 |
|
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
546 |
|
#endif |
547 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context->but_edit); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context->but_edit); |
548 |
gtk_signal_connect(GTK_OBJECT(context->but_edit), "clicked", |
gtk_signal_connect(GTK_OBJECT(context->but_edit), "clicked", |
549 |
GTK_SIGNAL_FUNC(on_location_edit), context); |
GTK_SIGNAL_FUNC(on_location_edit), context); |
550 |
|
|
551 |
context->but_remove = gtk_button_new_with_label(_("Remove")); |
context->but_remove = gtk_button_new_with_label(_("Remove")); |
552 |
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
553 |
|
hildon_gtk_widget_set_theme_size(context->but_remove, |
554 |
|
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
555 |
|
#endif |
556 |
gtk_widget_set_sensitive(context->but_remove, |
gtk_widget_set_sensitive(context->but_remove, |
557 |
context->appdata->active_location); |
context->appdata->active_location); |
558 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context->but_remove); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context->but_remove); |
559 |
gtk_signal_connect(GTK_OBJECT(context->but_remove), "clicked", |
gtk_signal_connect(GTK_OBJECT(context->but_remove), "clicked", |
560 |
GTK_SIGNAL_FUNC(on_location_remove), context); |
GTK_SIGNAL_FUNC(on_location_remove), context); |
561 |
|
|
562 |
|
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
563 |
|
return vbox; |
564 |
|
} |
565 |
|
|
566 |
|
static GtkWidget *title_new(char *title) { |
567 |
|
GtkWidget *vbox = gtk_vbox_new(FALSE, 10); |
568 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), gtk_label_new("")); |
569 |
|
GtkWidget *hbox = gtk_hbox_new(FALSE, 0); |
570 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_hseparator_new()); |
571 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_label_new(title)); |
572 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_hseparator_new()); |
573 |
gtk_box_pack_start_defaults(GTK_BOX(vbox), hbox); |
gtk_box_pack_start_defaults(GTK_BOX(vbox), hbox); |
574 |
return vbox; |
return vbox; |
575 |
} |
} |
576 |
|
|
577 |
void cb_menu_settings(GtkWidget *window, gpointer data) { |
void cb_menu_settings(GtkWidget *window, gpointer data) { |
578 |
appdata_t *appdata = (appdata_t *)data; |
appdata_t *appdata = (appdata_t *)data; |
579 |
GtkWidget *table, *label, *hbox, *notebook; |
GtkWidget *vbox, *label, *hbox, *ihbox; |
580 |
GtkWidget *cbox_imperial; |
GtkWidget *cbox_imperial; |
581 |
settings_dialog_state_t hstate; |
settings_dialog_state_t hstate; |
582 |
|
|
589 |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
590 |
hildon_help_dialog_help_enable(GTK_DIALOG(dialog), |
hildon_help_dialog_help_enable(GTK_DIALOG(dialog), |
591 |
HELP_ID_SETTINGS, appdata->osso_context); |
HELP_ID_SETTINGS, appdata->osso_context); |
|
gtk_window_set_default_size(GTK_WINDOW(dialog), 550, 100); |
|
592 |
#endif |
#endif |
593 |
|
|
594 |
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
595 |
notebook = gtk_notebook_new(), TRUE, TRUE, 0); |
gtk_window_set_default_size(GTK_WINDOW(dialog), 550, 500); |
596 |
|
#endif |
597 |
|
|
598 |
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
599 |
|
/* in fremantle all settings reside in one pannable long list */ |
600 |
|
GtkWidget *pannable_area = hildon_pannable_area_new(); |
601 |
|
|
602 |
|
/* all elements are inside one long vbox */ |
603 |
|
vbox = gtk_vbox_new(FALSE, 0); |
604 |
|
#else |
605 |
|
GtkWidget *notebook = gtk_notebook_new(); |
606 |
|
#endif |
607 |
|
|
608 |
/* ------------------ the "home" widget ---------------------- */ |
/* ------------------ the "home" widget ---------------------- */ |
609 |
table = gtk_table_new(2, 2, FALSE); |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
610 |
|
// gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("GPS"))); |
611 |
|
#else |
612 |
|
vbox = gtk_vbox_new(FALSE, 0); |
613 |
|
#endif |
614 |
|
|
615 |
hstate.cbox_gps = gtk_check_button_new_with_label(_("Enable GPS")); |
hstate.cbox_gps = check_button_new_with_label(_("Enable GPS")); |
616 |
gtk_table_attach(GTK_TABLE(table), |
check_button_set_active(hstate.cbox_gps, appdata->use_gps); |
617 |
hstate.cbox_gps, 0, 2, 0, 1, GTK_FILL, 0, 2, 0); |
gtk_box_pack_start(GTK_BOX(vbox), hstate.cbox_gps, FALSE, FALSE, 0); |
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hstate.cbox_gps), |
|
|
appdata->use_gps); |
|
618 |
|
|
619 |
location_context_t location_context; |
location_context_t location_context; |
620 |
memset(&location_context, 0, sizeof(location_context_t)); |
memset(&location_context, 0, sizeof(location_context_t)); |
622 |
location_context.settings_dialog = dialog; |
location_context.settings_dialog = dialog; |
623 |
|
|
624 |
/* location widget */ |
/* location widget */ |
625 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_box_pack_start(GTK_BOX(vbox), hstate.loc = location_widget(&location_context), |
626 |
hstate.loc = location_widget(&location_context), 0, 2, 1, 2); |
TRUE, TRUE, 0); |
627 |
|
|
628 |
settings_update(NULL, &hstate); |
settings_update(NULL, &hstate); |
629 |
|
|
630 |
/* Connect the "clicked" signal of the button to our callback */ |
/* Connect the "toggled" signal of the button to our callback */ |
631 |
gtk_signal_connect (GTK_OBJECT (hstate.cbox_gps), "clicked", |
gtk_signal_connect (GTK_OBJECT (hstate.cbox_gps), "toggled", |
632 |
GTK_SIGNAL_FUNC(settings_update), (gpointer)&hstate); |
GTK_SIGNAL_FUNC(settings_update), (gpointer)&hstate); |
633 |
|
|
634 |
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
635 |
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, |
636 |
gtk_label_new(_("GPS"))); |
gtk_label_new(_("GPS"))); |
637 |
|
#endif |
638 |
|
|
639 |
/* ---------------- misc old main menu entries ----------------- */ |
/* ---------------- misc old main menu entries ----------------- */ |
640 |
|
|
641 |
table = gtk_table_new(2, 2, FALSE); |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
642 |
|
// gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("Misc"))); |
643 |
|
#else |
644 |
|
vbox = gtk_vbox_new(FALSE, 0); |
645 |
|
#endif |
646 |
|
|
647 |
|
cbox_imperial = check_button_new_with_label(_("Imperial units")); |
648 |
|
check_button_set_active(cbox_imperial, appdata->imperial); |
649 |
|
gtk_box_pack_start(GTK_BOX(vbox), cbox_imperial, FALSE, FALSE, 0); |
650 |
|
|
651 |
cbox_imperial = gtk_check_button_new_with_label( |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
652 |
_("Imperial units")); |
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, |
|
gtk_table_attach(GTK_TABLE(table), |
|
|
cbox_imperial, 0, 2, 0, 1, GTK_FILL, 0, 2, 0); |
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_imperial), |
|
|
appdata->imperial); |
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, |
|
653 |
gtk_label_new(_("Misc"))); |
gtk_label_new(_("Misc"))); |
654 |
|
#endif |
655 |
|
|
656 |
/* ----------------- gpxlist settings ------------------- */ |
/* ----------------- gpxlist settings ------------------- */ |
657 |
|
|
658 |
table = gtk_table_new(1, 2, FALSE); |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
659 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("GPX list"))); |
660 |
|
#else |
661 |
|
vbox = gtk_vbox_new(FALSE, 0); |
662 |
|
#endif |
663 |
|
|
664 |
hbox = gtk_hbox_new(FALSE,2); |
hbox = gtk_hbox_new(FALSE,2); |
665 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), |
ihbox = gtk_hbox_new(FALSE, 0); |
666 |
label = gtk_label_new(_("Visible items:"))); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), label = gtk_label_new(_("Visible items:"))); |
667 |
gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f); |
gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f); |
668 |
|
|
669 |
GtkWidget *cbox_fname = gtk_check_button_new_with_label(_("Filename")); |
GtkWidget *cbox_fname = toggle_button_new_with_label(_("Filename")); |
670 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_fname), |
toggle_button_set_active(cbox_fname, appdata->gpxlist_items & GPXLIST_ITEM_FILENAME); |
671 |
appdata->gpxlist_items & GPXLIST_ITEM_FILENAME); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_fname); |
672 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_fname); |
GtkWidget *cbox_date = toggle_button_new_with_label(_("Date")); |
673 |
GtkWidget *cbox_date = gtk_check_button_new_with_label(_("Date")); |
toggle_button_set_active(cbox_date, appdata->gpxlist_items & GPXLIST_ITEM_DATE); |
674 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_date), |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_date); |
675 |
appdata->gpxlist_items & GPXLIST_ITEM_DATE); |
GtkWidget *cbox_num = toggle_button_new_with_label(_("# Caches")); |
676 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_date); |
toggle_button_set_active(cbox_num, appdata->gpxlist_items & GPXLIST_ITEM_CNUM); |
677 |
GtkWidget *cbox_num = gtk_check_button_new_with_label(_("# Caches")); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_num); |
678 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_num), |
gtk_box_pack_start_defaults(GTK_BOX(hbox), ihbox); |
|
appdata->gpxlist_items & GPXLIST_ITEM_CNUM); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_num); |
|
679 |
|
|
680 |
gtk_table_attach(GTK_TABLE(table), hbox, 0, 2, 0, 1, GTK_FILL, 0, 2, 0); |
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
681 |
|
|
682 |
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
683 |
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, |
684 |
gtk_label_new(_("GPX list"))); |
gtk_label_new(_("GPX list"))); |
685 |
|
#endif |
686 |
|
|
687 |
/* ----------------- cachelist settings ------------------- */ |
/* ----------------- cachelist settings ------------------- */ |
688 |
|
|
689 |
table = gtk_table_new(4, 2, FALSE); |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
690 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("Cache list"))); |
691 |
|
#else |
692 |
|
vbox = gtk_vbox_new(FALSE, 0); |
693 |
|
#endif |
694 |
|
|
695 |
hbox = gtk_hbox_new(FALSE,2); |
hbox = gtk_hbox_new(FALSE,2); |
696 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), |
ihbox = gtk_hbox_new(FALSE, 0); |
697 |
label = gtk_label_new(_("Visible items:"))); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), label = gtk_label_new(_("Visible items:"))); |
698 |
gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f); |
gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f); |
699 |
|
|
700 |
GtkWidget *cbox_wpt = gtk_check_button_new_with_label(_("Wpt")); |
GtkWidget *cbox_wpt = toggle_button_new_with_label(_("Wpt")); |
701 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_wpt), |
toggle_button_set_active(cbox_wpt, appdata->cachelist_items & CACHELIST_ITEM_ID); |
702 |
appdata->cachelist_items & CACHELIST_ITEM_ID); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_wpt); |
703 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_wpt); |
GtkWidget *cbox_size = toggle_button_new_with_label(_("Size")); |
704 |
GtkWidget *cbox_size = gtk_check_button_new_with_label(_("Size")); |
toggle_button_set_active(cbox_size, appdata->cachelist_items & CACHELIST_ITEM_SIZE); |
705 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_size), |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_size); |
706 |
appdata->cachelist_items & CACHELIST_ITEM_SIZE); |
GtkWidget *cbox_rate = toggle_button_new_with_label(_("Rating")); |
707 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_size); |
toggle_button_set_active(cbox_rate, appdata->cachelist_items & CACHELIST_ITEM_RATING); |
708 |
GtkWidget *cbox_rate = gtk_check_button_new_with_label(_("Rating")); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_rate); |
709 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_rate), |
gtk_box_pack_start_defaults(GTK_BOX(hbox), ihbox); |
|
appdata->cachelist_items & CACHELIST_ITEM_RATING); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_rate); |
|
710 |
|
|
711 |
gtk_table_attach(GTK_TABLE(table), hbox, 0, 2, 0, 1, GTK_FILL, 0, 2, 0); |
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
712 |
|
|
713 |
GtkWidget *cbox_cachelist_hidef = |
GtkWidget *cbox_cachelist_hidef = |
714 |
gtk_check_button_new_with_label(_("Hide caches marked \"found\"")); |
check_button_new_with_label(_("Hide caches marked \"found\"")); |
715 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_cachelist_hidef), |
check_button_set_active(cbox_cachelist_hidef, appdata->cachelist_hide_found); |
|
appdata->cachelist_hide_found); |
|
|
gtk_table_attach(GTK_TABLE(table), cbox_cachelist_hidef, |
|
|
0, 2, 1, 2, GTK_FILL, 0, 2, 0); |
|
716 |
|
|
717 |
|
gtk_box_pack_start(GTK_BOX(vbox), cbox_cachelist_hidef, FALSE, FALSE, 0); |
718 |
|
|
719 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
720 |
GtkWidget *cbox_cachelist_dss = |
GtkWidget *cbox_cachelist_dss = |
721 |
gtk_check_button_new_with_label(_("Disable screen saver")); |
check_button_new_with_label(_("Disable screen saver")); |
722 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_cachelist_dss), |
check_button_set_active(cbox_cachelist_dss, appdata->cachelist_disable_screensaver); |
723 |
appdata->cachelist_disable_screensaver); |
|
724 |
gtk_table_attach(GTK_TABLE(table), cbox_cachelist_dss, |
gtk_box_pack_start(GTK_BOX(vbox), cbox_cachelist_dss, FALSE, FALSE, 0); |
|
0, 2, 2, 3, GTK_FILL, 0, 2, 0); |
|
725 |
#endif |
#endif |
726 |
|
|
727 |
GtkWidget *cbox_update = |
GtkWidget *cbox_update = |
728 |
gtk_check_button_new_with_label(_("Update every 30 sec")); |
check_button_new_with_label(_("Update every 30 sec")); |
729 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_update), |
check_button_set_active(cbox_update, appdata->cachelist_update); |
730 |
appdata->cachelist_update); |
gtk_box_pack_start(GTK_BOX(vbox), cbox_update, FALSE, FALSE, 0); |
|
gtk_table_attach(GTK_TABLE(table), cbox_update, |
|
|
0, 2, 3, 4, GTK_FILL, 0, 2, 0); |
|
731 |
|
|
732 |
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
733 |
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, |
734 |
gtk_label_new(_("Cache list"))); |
gtk_label_new(_("Cache list"))); |
735 |
|
#endif |
736 |
|
|
737 |
/* ----------------- cache settings ------------------- */ |
/* ----------------- cache settings ------------------- */ |
738 |
|
|
739 |
table = gtk_table_new(2, 2, FALSE); |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
740 |
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("Cache"))); |
741 |
|
#else |
742 |
|
vbox = gtk_vbox_new(FALSE, 0); |
743 |
|
#endif |
744 |
|
|
745 |
hbox = gtk_hbox_new(FALSE,2); |
hbox = gtk_hbox_new(FALSE,2); |
746 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), |
gtk_box_pack_start_defaults(GTK_BOX(hbox), |
755 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), scale); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), scale); |
756 |
gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("Max")), FALSE, FALSE,0); |
gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("Max")), FALSE, FALSE,0); |
757 |
|
|
758 |
gtk_table_attach(GTK_TABLE(table), hbox, 0, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); |
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
759 |
|
|
760 |
|
GtkWidget *cbox_gcvote = check_button_new_with_label(_("Use GCVote service")); |
761 |
|
check_button_set_active(cbox_gcvote, !appdata->disable_gcvote); |
762 |
|
gtk_box_pack_start(GTK_BOX(vbox), cbox_gcvote, FALSE, FALSE, 0); |
763 |
|
|
764 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
765 |
GtkWidget *cbox_goto_dss = gtk_check_button_new_with_label( |
GtkWidget *cbox_goto_dss = check_button_new_with_label( |
766 |
_("Disable screen saver in \"goto\" view")); |
_("Disable screen saver in \"goto\" view")); |
767 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_goto_dss), |
check_button_set_active(cbox_goto_dss, appdata->goto_disable_screensaver); |
768 |
appdata->goto_disable_screensaver); |
gtk_box_pack_start(GTK_BOX(vbox), cbox_goto_dss, FALSE, FALSE, 0); |
|
gtk_table_attach(GTK_TABLE(table), cbox_goto_dss, 0, 2, 1, 2, GTK_FILL, 0, 2, 0); |
|
769 |
#endif |
#endif |
770 |
|
|
771 |
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
772 |
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, |
773 |
gtk_label_new(_("Cache"))); |
gtk_label_new(_("Cache"))); |
774 |
|
#endif |
775 |
|
|
776 |
/* -------------------------------------------------------- */ |
/* -------------------------------------------------------- */ |
777 |
|
|
778 |
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
779 |
|
hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA(pannable_area), vbox); |
780 |
|
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), pannable_area); |
781 |
|
#else |
782 |
|
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook); |
783 |
|
#endif |
784 |
|
|
785 |
gtk_widget_show_all(dialog); |
gtk_widget_show_all(dialog); |
786 |
|
|
787 |
if(GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { |
if(GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { |
788 |
gboolean prev_cachelist_hide_found = appdata->cachelist_hide_found; |
gboolean prev_cachelist_hide_found = appdata->cachelist_hide_found; |
789 |
|
|
790 |
appdata->use_gps = gtk_toggle_button_get_active( |
appdata->use_gps = |
791 |
GTK_TOGGLE_BUTTON(hstate.cbox_gps)); |
check_button_get_active(hstate.cbox_gps); |
792 |
appdata->imperial = gtk_toggle_button_get_active( |
appdata->imperial = |
793 |
GTK_TOGGLE_BUTTON(cbox_imperial)); |
check_button_get_active(cbox_imperial); |
794 |
|
|
795 |
appdata->compass_damping = 0.5 + gtk_range_get_value(GTK_RANGE(scale)); |
appdata->compass_damping = 0.5 + gtk_range_get_value(GTK_RANGE(scale)); |
796 |
|
|
797 |
appdata->gpxlist_items = GPXLIST_ITEM_VALID; |
appdata->gpxlist_items = GPXLIST_ITEM_VALID; |
798 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_fname))) |
if(toggle_button_get_active(cbox_fname)) |
799 |
appdata->gpxlist_items |= GPXLIST_ITEM_FILENAME; |
appdata->gpxlist_items |= GPXLIST_ITEM_FILENAME; |
800 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_date))) |
if(toggle_button_get_active(cbox_date)) |
801 |
appdata->gpxlist_items |= GPXLIST_ITEM_DATE; |
appdata->gpxlist_items |= GPXLIST_ITEM_DATE; |
802 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_num))) |
if(toggle_button_get_active(cbox_num)) |
803 |
appdata->gpxlist_items |= GPXLIST_ITEM_CNUM; |
appdata->gpxlist_items |= GPXLIST_ITEM_CNUM; |
804 |
|
|
805 |
appdata->cachelist_items = CACHELIST_ITEM_VALID; |
appdata->cachelist_items = CACHELIST_ITEM_VALID; |
806 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_wpt))) |
if(toggle_button_get_active(cbox_wpt)) |
807 |
appdata->cachelist_items |= CACHELIST_ITEM_ID; |
appdata->cachelist_items |= CACHELIST_ITEM_ID; |
808 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_size))) |
if(toggle_button_get_active(cbox_size)) |
809 |
appdata->cachelist_items |= CACHELIST_ITEM_SIZE; |
appdata->cachelist_items |= CACHELIST_ITEM_SIZE; |
810 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_rate))) |
if(toggle_button_get_active(cbox_rate)) |
811 |
appdata->cachelist_items |= CACHELIST_ITEM_RATING; |
appdata->cachelist_items |= CACHELIST_ITEM_RATING; |
812 |
|
|
813 |
appdata->cachelist_hide_found = gtk_toggle_button_get_active( |
appdata->cachelist_hide_found = |
814 |
GTK_TOGGLE_BUTTON(cbox_cachelist_hidef)); |
check_button_get_active(cbox_cachelist_hidef); |
815 |
|
|
816 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
817 |
appdata->goto_disable_screensaver = gtk_toggle_button_get_active( |
appdata->goto_disable_screensaver = |
818 |
GTK_TOGGLE_BUTTON(cbox_goto_dss)); |
check_button_get_active(cbox_goto_dss); |
819 |
appdata->cachelist_disable_screensaver = gtk_toggle_button_get_active( |
appdata->cachelist_disable_screensaver = |
820 |
GTK_TOGGLE_BUTTON(cbox_cachelist_dss)); |
check_button_get_active(cbox_cachelist_dss); |
821 |
#endif |
#endif |
822 |
appdata->cachelist_update = gtk_toggle_button_get_active( |
appdata->cachelist_update = check_button_get_active(cbox_update); |
823 |
GTK_TOGGLE_BUTTON(cbox_update)); |
|
824 |
|
appdata->disable_gcvote = !check_button_get_active(cbox_gcvote); |
825 |
|
|
826 |
/* build some additional flags that are used to decide whether a */ |
/* build some additional flags that are used to decide whether a */ |
827 |
/* redraw is necessary */ |
/* redraw is necessary */ |