Diff of /trunk/src/settings.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 129 by harbaum, Tue Sep 29 14:30:16 2009 UTC revision 204 by harbaum, Mon Nov 23 18:32:06 2009 UTC
# Line 20  Line 20 
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);
# Line 205  static void on_location_edit(GtkWidget * Line 258  static void on_location_edit(GtkWidget *
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",
# Line 381  view_selection_func(GtkTreeSelection *se Line 434  view_selection_func(GtkTreeSelection *se
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)),
# Line 451  static GtkWidget *location_widget(locati Line 509  static GtkWidget *location_widget(locati
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    #ifdef FREMANTLE
567    static GtkWidget *title_new(char *title) {
568      GtkWidget *vbox = gtk_vbox_new(FALSE, 10);
569      gtk_box_pack_start_defaults(GTK_BOX(vbox), gtk_label_new(""));
570      GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
571      gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_hseparator_new());
572      gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_label_new(title));
573      gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_hseparator_new());
574    gtk_box_pack_start_defaults(GTK_BOX(vbox), hbox);    gtk_box_pack_start_defaults(GTK_BOX(vbox), hbox);
575    return vbox;    return vbox;
576  }  }
577    #endif
578    
579  void cb_menu_settings(GtkWidget *window, gpointer data) {  void cb_menu_settings(GtkWidget *window, gpointer data) {
580    appdata_t *appdata = (appdata_t *)data;    appdata_t *appdata = (appdata_t *)data;
581    GtkWidget *table, *label, *hbox, *notebook;    GtkWidget *vbox, *label, *hbox, *ihbox;
582    GtkWidget *cbox_imperial;    GtkWidget *cbox_imperial;
583    settings_dialog_state_t hstate;    settings_dialog_state_t hstate;
584    
# Line 509  void cb_menu_settings(GtkWidget *window, Line 591  void cb_menu_settings(GtkWidget *window,
591  #if defined(USE_MAEMO) && defined(HILDON_HELP)  #if defined(USE_MAEMO) && defined(HILDON_HELP)
592    hildon_help_dialog_help_enable(GTK_DIALOG(dialog),    hildon_help_dialog_help_enable(GTK_DIALOG(dialog),
593                   HELP_ID_SETTINGS, appdata->osso_context);                   HELP_ID_SETTINGS, appdata->osso_context);
   gtk_window_set_default_size(GTK_WINDOW(dialog), 550, 100);  
594  #endif  #endif
595    
596    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
597                       notebook = gtk_notebook_new(), TRUE, TRUE, 0);    gtk_window_set_default_size(GTK_WINDOW(dialog), 550, 500);
598    #endif
599    
600    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
601      /* in fremantle all settings reside in one pannable long list */
602      GtkWidget *pannable_area = hildon_pannable_area_new();
603    
604      /* all elements are inside one long vbox */
605      vbox = gtk_vbox_new(FALSE, 0);
606    #else
607      GtkWidget *notebook = gtk_notebook_new();
608    #endif
609    
610    /* ------------------ the "home" widget ---------------------- */    /* ------------------ the "home" widget ---------------------- */
611    table = gtk_table_new(2, 2, FALSE);  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
612      // gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("GPS")));
613    #else
614      vbox = gtk_vbox_new(FALSE, 0);
615    #endif
616    
617    hstate.cbox_gps = gtk_check_button_new_with_label(_("Enable GPS"));    hstate.cbox_gps = check_button_new_with_label(_("Enable GPS"));
618    gtk_table_attach(GTK_TABLE(table),    check_button_set_active(hstate.cbox_gps, appdata->use_gps);
619                     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);  
620    
621    location_context_t location_context;    location_context_t location_context;
622    memset(&location_context, 0, sizeof(location_context_t));    memset(&location_context, 0, sizeof(location_context_t));
# Line 531  void cb_menu_settings(GtkWidget *window, Line 624  void cb_menu_settings(GtkWidget *window,
624    location_context.settings_dialog = dialog;    location_context.settings_dialog = dialog;
625    
626    /* location widget */    /* location widget */
627    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_box_pack_start(GTK_BOX(vbox), hstate.loc = location_widget(&location_context),
628              hstate.loc = location_widget(&location_context), 0, 2, 1, 2);                       TRUE, TRUE, 0);
629    
630    settings_update(NULL, &hstate);    settings_update(NULL, &hstate);
631    
632    /* Connect the "clicked" signal of the button to our callback */    /* Connect the "toggled" signal of the button to our callback */
633    gtk_signal_connect (GTK_OBJECT (hstate.cbox_gps), "clicked",    gtk_signal_connect (GTK_OBJECT (hstate.cbox_gps), "toggled",
634                        GTK_SIGNAL_FUNC(settings_update), (gpointer)&hstate);                        GTK_SIGNAL_FUNC(settings_update), (gpointer)&hstate);
635    
636    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table,  #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
637      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
638                             gtk_label_new(_("GPS")));                             gtk_label_new(_("GPS")));
639    #endif
640    
641    /* ---------------- misc old main menu entries ----------------- */    /* ---------------- misc old main menu entries ----------------- */
642    
643    table = gtk_table_new(2, 2, FALSE);  #ifndef FREMANTLE
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      hbox = gtk_hbox_new(FALSE,2);
652      gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("Username:")),
653                         FALSE, FALSE, 0);
654    #ifndef FREMANTLE
655      GtkWidget *username = gtk_entry_new();
656    #else
657      GtkWidget *username = hildon_entry_new(HILDON_SIZE_AUTO);
658    #endif
659    
660    cbox_imperial = gtk_check_button_new_with_label(    if(appdata->username)
661                           _("Imperial units"));      gtk_entry_set_text(GTK_ENTRY(username), appdata->username);
662    gtk_table_attach(GTK_TABLE(table),  
663                     cbox_imperial, 0, 2, 0, 1, GTK_FILL, 0, 2, 0);    gtk_box_pack_start(GTK_BOX(hbox), username, FALSE, FALSE, 0);
664    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_imperial),  
665                                 appdata->imperial);    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
666    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table,  
667    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
668      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
669                             gtk_label_new(_("Misc")));                             gtk_label_new(_("Misc")));
670    #endif
671    
672    /* ----------------- gpxlist settings ------------------- */    /* ----------------- gpxlist settings ------------------- */
673    
674    table = gtk_table_new(1, 2, FALSE);  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
675      gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("GPX list")));
676    #else
677      vbox = gtk_vbox_new(FALSE, 0);
678    #endif
679    
680    hbox = gtk_hbox_new(FALSE,2);    hbox = gtk_hbox_new(FALSE,2);
681    gtk_box_pack_start_defaults(GTK_BOX(hbox),    ihbox = gtk_hbox_new(FALSE, 0);
682              label = gtk_label_new(_("Visible items:")));    gtk_box_pack_start_defaults(GTK_BOX(hbox), label = gtk_label_new(_("Visible items:")));
683    gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);    gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);
684    
685    GtkWidget *cbox_fname = gtk_check_button_new_with_label(_("Filename"));    GtkWidget *cbox_fname = toggle_button_new_with_label(_("Filename"));
686    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_fname),    toggle_button_set_active(cbox_fname, appdata->gpxlist_items & GPXLIST_ITEM_FILENAME);
687                         appdata->gpxlist_items & GPXLIST_ITEM_FILENAME);    gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_fname);
688    gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_fname);    GtkWidget *cbox_date = toggle_button_new_with_label(_("Date"));
689    GtkWidget *cbox_date = gtk_check_button_new_with_label(_("Date"));    toggle_button_set_active(cbox_date, appdata->gpxlist_items & GPXLIST_ITEM_DATE);
690    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_date),    gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_date);
691                         appdata->gpxlist_items & GPXLIST_ITEM_DATE);    GtkWidget *cbox_num = toggle_button_new_with_label(_("# Caches"));
692    gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_date);    toggle_button_set_active(cbox_num, appdata->gpxlist_items & GPXLIST_ITEM_CNUM);
693    GtkWidget *cbox_num = gtk_check_button_new_with_label(_("# Caches"));    gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_num);
694    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);  
695    
696    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);
697    
698    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table,  #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
699      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
700                             gtk_label_new(_("GPX list")));                             gtk_label_new(_("GPX list")));
701    #endif
702    
703    /* ----------------- cachelist settings ------------------- */    /* ----------------- cachelist settings ------------------- */
704    
705    table = gtk_table_new(4, 2, FALSE);  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
706      gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("Cache list")));
707    #else
708      vbox = gtk_vbox_new(FALSE, 0);
709    #endif
710    
711    hbox = gtk_hbox_new(FALSE,2);    hbox = gtk_hbox_new(FALSE,2);
712    gtk_box_pack_start_defaults(GTK_BOX(hbox),    ihbox = gtk_hbox_new(FALSE, 0);
713              label = gtk_label_new(_("Visible items:")));    gtk_box_pack_start_defaults(GTK_BOX(hbox), label = gtk_label_new(_("Visible items:")));
714    gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);    gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);
715    
716    GtkWidget *cbox_wpt = gtk_check_button_new_with_label(_("Wpt"));    GtkWidget *cbox_wpt = toggle_button_new_with_label(_("Wpt"));
717    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_wpt),    toggle_button_set_active(cbox_wpt, appdata->cachelist_items & CACHELIST_ITEM_ID);
718                         appdata->cachelist_items & CACHELIST_ITEM_ID);    gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_wpt);
719    gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_wpt);    GtkWidget *cbox_size = toggle_button_new_with_label(_("Size"));
720    GtkWidget *cbox_size = gtk_check_button_new_with_label(_("Size"));    toggle_button_set_active(cbox_size, appdata->cachelist_items & CACHELIST_ITEM_SIZE);
721    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_size),    gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_size);
722                         appdata->cachelist_items & CACHELIST_ITEM_SIZE);    GtkWidget *cbox_rate = toggle_button_new_with_label(_("Rating"));
723    gtk_box_pack_start_defaults(GTK_BOX(hbox), cbox_size);    toggle_button_set_active(cbox_rate, appdata->cachelist_items & CACHELIST_ITEM_RATING);
724    GtkWidget *cbox_rate = gtk_check_button_new_with_label(_("Rating"));    gtk_box_pack_start_defaults(GTK_BOX(ihbox), cbox_rate);
725    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);  
726    
727    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);
728    
729    GtkWidget *cbox_cachelist_hidef =    GtkWidget *cbox_cachelist_hidef =
730      gtk_check_button_new_with_label(_("Hide caches marked \"found\""));      check_button_new_with_label(_("Hide caches marked \"found\""));
731    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);  
732    
733      gtk_box_pack_start(GTK_BOX(vbox), cbox_cachelist_hidef, FALSE, FALSE, 0);
734    
735  #ifdef USE_MAEMO  #ifdef USE_MAEMO
736    GtkWidget *cbox_cachelist_dss =    GtkWidget *cbox_cachelist_dss =
737      gtk_check_button_new_with_label(_("Disable screen saver"));      check_button_new_with_label(_("Disable screen saver"));
738    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_cachelist_dss),    check_button_set_active(cbox_cachelist_dss, appdata->cachelist_disable_screensaver);
739                                 appdata->cachelist_disable_screensaver);  
740    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);  
741  #endif  #endif
742    
743    GtkWidget *cbox_update =    GtkWidget *cbox_update =
744      gtk_check_button_new_with_label(_("Update every 30 sec"));      check_button_new_with_label(_("Update every 30 sec"));
745    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_update),    check_button_set_active(cbox_update, appdata->cachelist_update);
746                                 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);  
747    
748    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table,  #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
749      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
750                             gtk_label_new(_("Cache list")));                             gtk_label_new(_("Cache list")));
751    #endif
752    
753    /* ----------------- cache settings ------------------- */    /* ----------------- cache settings ------------------- */
754    
755    table = gtk_table_new(2, 2, FALSE);  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
756      gtk_box_pack_start_defaults(GTK_BOX(vbox), title_new(_("Cache")));
757    #else
758      vbox = gtk_vbox_new(FALSE, 0);
759    #endif
760    
761    hbox = gtk_hbox_new(FALSE,2);    hbox = gtk_hbox_new(FALSE,2);
762    gtk_box_pack_start_defaults(GTK_BOX(hbox),    gtk_box_pack_start_defaults(GTK_BOX(hbox),
# Line 651  void cb_menu_settings(GtkWidget *window, Line 771  void cb_menu_settings(GtkWidget *window,
771    gtk_box_pack_start_defaults(GTK_BOX(hbox), scale);    gtk_box_pack_start_defaults(GTK_BOX(hbox), scale);
772    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);
773    
774    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);
775    
776      GtkWidget *cbox_gcvote = check_button_new_with_label(_("Use GCVote service"));
777      check_button_set_active(cbox_gcvote, !appdata->disable_gcvote);
778      gtk_box_pack_start(GTK_BOX(vbox), cbox_gcvote, FALSE, FALSE, 0);
779    
780  #ifdef USE_MAEMO  #ifdef USE_MAEMO
781    GtkWidget *cbox_goto_dss = gtk_check_button_new_with_label(    GtkWidget *cbox_goto_dss = check_button_new_with_label(
782                              _("Disable screen saver in \"goto\" view"));                              _("Disable screen saver in \"goto\" view"));
783    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox_goto_dss),    check_button_set_active(cbox_goto_dss, appdata->goto_disable_screensaver);
784                                 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);  
785  #endif  #endif
786    
787    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table,  #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
788      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
789                             gtk_label_new(_("Cache")));                             gtk_label_new(_("Cache")));
790    #endif
791    
792    /* -------------------------------------------------------- */    /* -------------------------------------------------------- */
793    
794    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
795      hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA(pannable_area), vbox);
796      gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), pannable_area);
797    #else
798      gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook);
799    #endif
800    
801    gtk_widget_show_all(dialog);    gtk_widget_show_all(dialog);
802    
803    if(GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {    if(GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
804      gboolean prev_cachelist_hide_found = appdata->cachelist_hide_found;      gboolean prev_cachelist_hide_found = appdata->cachelist_hide_found;
805    
806      appdata->use_gps = gtk_toggle_button_get_active(      appdata->use_gps =
807                              GTK_TOGGLE_BUTTON(hstate.cbox_gps));        check_button_get_active(hstate.cbox_gps);
808      appdata->imperial = gtk_toggle_button_get_active(      appdata->imperial =
809                              GTK_TOGGLE_BUTTON(cbox_imperial));        check_button_get_active(cbox_imperial);
810    
811        if(appdata->username) {
812          g_free(appdata->username);
813          appdata->username = NULL;
814        }
815    
816        const char *uname = gtk_entry_get_text(GTK_ENTRY(username));
817        if(uname && strlen(uname)>0)
818          appdata->username = g_strdup(uname);
819    
820      appdata->compass_damping = 0.5 + gtk_range_get_value(GTK_RANGE(scale));      appdata->compass_damping = 0.5 + gtk_range_get_value(GTK_RANGE(scale));
821    
822      appdata->gpxlist_items = GPXLIST_ITEM_VALID;      appdata->gpxlist_items = GPXLIST_ITEM_VALID;
823      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_fname)))      if(toggle_button_get_active(cbox_fname))
824        appdata->gpxlist_items |= GPXLIST_ITEM_FILENAME;        appdata->gpxlist_items |= GPXLIST_ITEM_FILENAME;
825      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_date)))      if(toggle_button_get_active(cbox_date))
826        appdata->gpxlist_items |= GPXLIST_ITEM_DATE;        appdata->gpxlist_items |= GPXLIST_ITEM_DATE;
827      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_num)))      if(toggle_button_get_active(cbox_num))
828        appdata->gpxlist_items |= GPXLIST_ITEM_CNUM;        appdata->gpxlist_items |= GPXLIST_ITEM_CNUM;
829    
830      appdata->cachelist_items = CACHELIST_ITEM_VALID;      appdata->cachelist_items = CACHELIST_ITEM_VALID;
831      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_wpt)))      if(toggle_button_get_active(cbox_wpt))
832        appdata->cachelist_items |= CACHELIST_ITEM_ID;        appdata->cachelist_items |= CACHELIST_ITEM_ID;
833      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_size)))      if(toggle_button_get_active(cbox_size))
834        appdata->cachelist_items |= CACHELIST_ITEM_SIZE;        appdata->cachelist_items |= CACHELIST_ITEM_SIZE;
835      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbox_rate)))      if(toggle_button_get_active(cbox_rate))
836        appdata->cachelist_items |= CACHELIST_ITEM_RATING;        appdata->cachelist_items |= CACHELIST_ITEM_RATING;
837    
838      appdata->cachelist_hide_found = gtk_toggle_button_get_active(      appdata->cachelist_hide_found =
839                               GTK_TOGGLE_BUTTON(cbox_cachelist_hidef));        check_button_get_active(cbox_cachelist_hidef);
840    
841  #ifdef USE_MAEMO  #ifdef USE_MAEMO
842      appdata->goto_disable_screensaver = gtk_toggle_button_get_active(      appdata->goto_disable_screensaver =
843                               GTK_TOGGLE_BUTTON(cbox_goto_dss));        check_button_get_active(cbox_goto_dss);
844      appdata->cachelist_disable_screensaver = gtk_toggle_button_get_active(      appdata->cachelist_disable_screensaver =
845                               GTK_TOGGLE_BUTTON(cbox_cachelist_dss));        check_button_get_active(cbox_cachelist_dss);
846  #endif  #endif
847      appdata->cachelist_update = gtk_toggle_button_get_active(      appdata->cachelist_update = check_button_get_active(cbox_update);
848                               GTK_TOGGLE_BUTTON(cbox_update));  
849        appdata->disable_gcvote = !check_button_get_active(cbox_gcvote);
850    
851      /* build some additional flags that are used to decide whether a */      /* build some additional flags that are used to decide whether a */
852      /* redraw is necessary */      /* redraw is necessary */

Legend:
Removed from v.129  
changed lines
  Added in v.204