Diff of /trunk/src/notes.c

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

revision 1 by harbaum, Sat Jun 20 11:08:47 2009 UTC revision 221 by harbaum, Mon Nov 30 21:28:04 2009 UTC
# Line 27  Line 27 
27    
28  #include <math.h>  #include <math.h>
29    
30    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
31    #include <hildon/hildon-note.h>
32    #include <hildon/hildon-entry.h>
33    #include <hildon/hildon-check-button.h>
34    #endif
35    
36  #if !defined(LIBXML_TREE_ENABLED) || !defined(LIBXML_OUTPUT_ENABLED)  #if !defined(LIBXML_TREE_ENABLED) || !defined(LIBXML_OUTPUT_ENABLED)
37  #error "libxml doesn't support required tree or output"  #error "libxml doesn't support required tree or output"
38  #endif  #endif
39    
40  #include "gpxview.h"  #include "gpxview.h"
41    
42    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
43    #include <hildon/hildon-note.h>
44    #endif
45    
46  void gtk_text_buffer_set_can_paste_rich_text(GtkTextBuffer *buffer, gboolean);  void gtk_text_buffer_set_can_paste_rich_text(GtkTextBuffer *buffer, gboolean);
47  void gtk_text_buffer_set_rich_text_format(GtkTextBuffer *buffer, const gchar *);  void gtk_text_buffer_set_rich_text_format(GtkTextBuffer *buffer, const gchar *);
48    
49  #define TAG_STATE  GTK_STATE_PRELIGHT  #define TAG_STATE  GTK_STATE_PRELIGHT
50    
51    static GtkWidget *check_button_new_with_label(char *label) {
52    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
53      return gtk_check_button_new_with_label(label);
54    #else
55      GtkWidget *cbut =
56        hildon_check_button_new(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
57      gtk_button_set_label(GTK_BUTTON(cbut), label);
58      return cbut;
59    #endif
60    }
61    
62    static void check_button_set_active(GtkWidget *button, gboolean active) {
63    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
64      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active);
65    #else
66      hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active);
67    #endif
68    }
69    
70    static gboolean check_button_get_active(GtkWidget *button) {
71    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
72      return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
73    #else
74      return hildon_check_button_get_active(HILDON_CHECK_BUTTON(button));
75    #endif
76    }
77    
78  static notes_t *notes_load(appdata_t *appdata, cache_t *cache) {  static notes_t *notes_load(appdata_t *appdata, cache_t *cache) {
79    notes_t *notes = NULL;    notes_t *notes = NULL;
80    xmlDoc *doc = NULL;    xmlDoc *doc = NULL;
# Line 157  void notes_load_all(appdata_t *appdata, Line 194  void notes_load_all(appdata_t *appdata,
194    }    }
195  }  }
196    
197  static int notes_save(cache_context_t *context,  static int notes_write_file(cache_context_t *context,
198                        char *text, pos_t pos,                        char *text, pos_t pos,
199                        gboolean override, gboolean found,                        gboolean override, gboolean found,
200                        time_t ftime, gboolean logged) {                        time_t ftime, gboolean logged) {
201    
202      g_assert(context);
203      g_assert(context->cache);
204    
205      printf("write\n");
206    
207    /* build local path */    /* build local path */
208    int path_len = strlen(context->appdata->image_path) +    int path_len = strlen(context->appdata->image_path) +
209      2 * strlen(context->cache->id) + 6;      2 * strlen(context->cache->id) + 6;
210      printf("plen = %d\n", path_len);
211    
212    char *path = malloc(path_len);    char *path = malloc(path_len);
213    snprintf(path, path_len, "%s%s/%s.gpx",    snprintf(path, path_len, "%s%s/%s.gpx",
214             context->appdata->image_path,             context->appdata->image_path,
# Line 175  static int notes_save(cache_context_t *c Line 220  static int notes_save(cache_context_t *c
220      return -1;      return -1;
221    }    }
222    
223      printf("still al\n");
224    
225    LIBXML_TEST_VERSION;    LIBXML_TEST_VERSION;
226    
227    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
# Line 230  static int notes_save(cache_context_t *c Line 277  static int notes_save(cache_context_t *c
277    return 0;    return 0;
278  }  }
279    
280  /* this is called from the destroy event of the entire notebook */  static void notes_save(cache_context_t *context) {
 gint notes_destroy_event(GtkWidget *widget, gpointer data ) {  
   cache_context_t *context = (cache_context_t*)data;  
   
   printf("about to destroy notes view\n");  
   
281    /* only save if: there is a text which has been changed or */    /* only save if: there is a text which has been changed or */
282    /* there is a position which differs from the original one */    /* there is a position which differs from the original one */
283    /* or has been changed */    /* or has been changed */
# Line 251  gint notes_destroy_event(GtkWidget *widg Line 293  gint notes_destroy_event(GtkWidget *widg
293                                            &start, &end, FALSE);                                            &start, &end, FALSE);
294    
295      pos_t pos;      pos_t pos;
296      pos.lat = lat_get(context->notes.latw);      pos.lat = lat_entry_get(context->notes.latw);
297      pos.lon = lon_get(context->notes.lonw);      pos.lon = lon_entry_get(context->notes.lonw);
298    
299      gboolean override =      gboolean override =
300        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context->notes.overridew));        check_button_get_active(context->notes.overridew);
301      gboolean found =      gboolean found =
302        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context->notes.foundw));        check_button_get_active(context->notes.foundw);
303      gboolean logged =      gboolean logged =
304        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context->notes.loggedw));        check_button_get_active(context->notes.loggedw);
305    
306      /* required accuracy is 1/60000 degree */      if(pos_differ(&pos, &context->cache->pos))
307      if(((int)(pos.lat * 60000 + .5) !=        printf("position is modified\n");
         (int)(context->cache->pos.lat * 60000 + .5)) ||  
        ((int)(pos.lon * 60000 + .5) !=  
         (int)(context->cache->pos.lon * 60000 + .5)))  
       printf("position is modified %f != %f / %f != %f\n",  
              pos.lat * 60000 + .5, context->cache->pos.lat * 60000 + .5,  
              pos.lon * 60000 + .5, context->cache->pos.lon * 60000 + .5);  
308      if(override || found)      if(override || found)
309        printf("flags are set\n");        printf("flags are set\n");
310      if(strlen(text))      if(strlen(text))
311        printf("text is present\n");        printf("text is present\n");
312    
313      /* check if the notes are empty */      /* check if the notes are empty */
314      if(((int)(pos.lat * 60000 + .5) ==      if(!pos_differ(&pos, &context->cache->pos) &&
         (int)(context->cache->pos.lat * 60000 + .5)) &&  
        ((int)(pos.lon * 60000 + .5) ==  
         (int)(context->cache->pos.lon * 60000 + .5)) &&  
315         !override && !found && !logged && (strlen(text) == 0)) {         !override && !found && !logged && (strlen(text) == 0)) {
316        printf("notes are in default state, removing them if present\n");        printf("notes are in default state, removing them if present\n");
317    
# Line 331  gint notes_destroy_event(GtkWidget *widg Line 364  gint notes_destroy_event(GtkWidget *widg
364        /* we have to do two things here: */        /* we have to do two things here: */
365        /* - update the notes.xml file on disk */        /* - update the notes.xml file on disk */
366        /* - update the notes entry in the loaded gpx tree */        /* - update the notes entry in the loaded gpx tree */
   
       /* update file on disk */  
       notes_save(context, text, pos, override, found,  
                  context->notes.ftime, logged);  
367    
368          /* update file on disk */
369          notes_write_file(context, text, pos, override, found,
370                           context->notes.ftime, logged);
371    
372        /* search for matching caches and replace note there */        /* search for matching caches and replace note there */
373        notes_t *note = NULL;        notes_t *note = NULL;
374        gpx_t *gpx = context->appdata->gpx;        gpx_t *gpx = context->appdata->gpx;
# Line 382  gint notes_destroy_event(GtkWidget *widg Line 415  gint notes_destroy_event(GtkWidget *widg
415    
416      if(text) free(text);      if(text) free(text);
417    }    }
418    }
419    
420    /* this is called from the destroy event of the entire notebook */
421    gint notes_destroy_event(GtkWidget *widget, gpointer data ) {
422      cache_context_t *context = (cache_context_t*)data;
423    
424      printf("about to destroy notes view\n");
425      notes_save(context);
426    
427    return FALSE;    return FALSE;
428  }  }
429    
430    #ifndef NO_COPY_N_PASTE
431  static void on_destroy_textview(GtkWidget *widget, gpointer data) {  static void on_destroy_textview(GtkWidget *widget, gpointer data) {
432    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
433    
# Line 412  static void on_destroy_textview(GtkWidge Line 454  static void on_destroy_textview(GtkWidge
454      }      }
455    }    }
456  }  }
457    #endif
458    
459  static void ftime_update(GtkWidget *widget, cache_context_t *context,  static void ftime_update(GtkWidget *widget, cache_context_t *context,
460                           gboolean update) {                           gboolean update) {
461    /* check if it has been selected */    /* check if it has been selected */
462    if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {    if(check_button_get_active(widget)) {
463      printf("set active\n");      printf("set active\n");
464    
465      if(update)      if(update)
# Line 448  static void callback_modified(GtkWidget Line 491  static void callback_modified(GtkWidget
491      printf("was foundw\n");      printf("was foundw\n");
492    
493      /* about to remove "found" flag -> ask for confirmation */      /* about to remove "found" flag -> ask for confirmation */
494      if(!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {      if(!check_button_get_active(widget)) {
495    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
496        GtkWidget *dialog = gtk_message_dialog_new(        GtkWidget *dialog = gtk_message_dialog_new(
497                   GTK_WINDOW(context->appdata->window),                   GTK_WINDOW(context->appdata->window),
498                   GTK_DIALOG_DESTROY_WITH_PARENT,                   GTK_DIALOG_DESTROY_WITH_PARENT,
# Line 462  static void callback_modified(GtkWidget Line 506  static void callback_modified(GtkWidget
506        if(GTK_RESPONSE_NO == gtk_dialog_run(GTK_DIALOG(dialog)))        if(GTK_RESPONSE_NO == gtk_dialog_run(GTK_DIALOG(dialog)))
507          gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);          gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
508    
509    #else
510          GtkWidget *dialog =
511            hildon_note_new_confirmation(GTK_WINDOW(context->appdata->window),
512                     _("Do you really want to remove the \"found\" flag? "
513                       "This will void the recorded date of your find!"));
514    
515          /* set the active flag again if the user answered "no" */
516          if(GTK_RESPONSE_OK != gtk_dialog_run(GTK_DIALOG(dialog)))
517            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
518    #endif
519    
520        gtk_widget_destroy(dialog);        gtk_widget_destroy(dialog);
521      }      }
522    
# Line 472  static void callback_modified(GtkWidget Line 527  static void callback_modified(GtkWidget
527      printf("was loggedw\n");      printf("was loggedw\n");
528    
529      /* about to remove "found" flag -> ask for confirmation */      /* about to remove "found" flag -> ask for confirmation */
530      if(!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {      if(!check_button_get_active(widget)) {
531    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
532        GtkWidget *dialog = gtk_message_dialog_new(        GtkWidget *dialog = gtk_message_dialog_new(
533                   GTK_WINDOW(context->appdata->window),                   GTK_WINDOW(context->appdata->window),
534                   GTK_DIALOG_DESTROY_WITH_PARENT,                   GTK_DIALOG_DESTROY_WITH_PARENT,
# Line 491  static void callback_modified(GtkWidget Line 547  static void callback_modified(GtkWidget
547          gtk_widget_set_sensitive(context->notes.foundw, TRUE);          gtk_widget_set_sensitive(context->notes.foundw, TRUE);
548        }        }
549    
550    #else
551          GtkWidget *dialog =
552            hildon_note_new_confirmation(GTK_WINDOW(context->appdata->window),
553                       _("Do you really want to remove the \"logged\" flag? "
554                       "This may cause problems on your next Garmin Field "
555                       "Notes upload!"));
556    
557          /* set the active flag again if the user answered "no" */
558          if(GTK_RESPONSE_OK != gtk_dialog_run(GTK_DIALOG(dialog)))
559            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
560          else {
561            gtk_widget_set_sensitive(widget, FALSE);
562            gtk_widget_set_sensitive(context->notes.foundw, TRUE);
563          }
564    
565    #endif
566    
567        gtk_widget_destroy(dialog);        gtk_widget_destroy(dialog);
568      }      }
569    }    }
570  }  }
571    
572    #ifndef NO_COPY_N_PASTE
573  static gboolean focus_in(GtkWidget *widget, GdkEventFocus *event,  static gboolean focus_in(GtkWidget *widget, GdkEventFocus *event,
574                           gpointer data) {                           gpointer data) {
575    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
# Line 514  static gboolean focus_in(GtkWidget *widg Line 588  static gboolean focus_in(GtkWidget *widg
588    
589    return FALSE;    return FALSE;
590  }  }
591    #endif
592    
593    static gboolean focus_out(GtkWidget *widget, GdkEventFocus *event,
594                             gpointer data) {
595      cache_context_t *context = (cache_context_t*)data;
596    
597      notes_save(context);
598    #if !defined(USE_MAEMO) && defined(ENABLE_OSM_GPS_MAP)
599      map_update(context->appdata);
600    #endif
601    
602      return FALSE;
603    }
604    
605  GtkWidget *cache_notes(cache_context_t *context) {  GtkWidget *cache_notes(cache_context_t *context) {
   appdata_t *appdata = context->appdata;  
606    cache_t *cache = context->cache;    cache_t *cache = context->cache;
607    
608    context->notes.modified = FALSE;    context->notes.modified = FALSE;
# Line 531  GtkWidget *cache_notes(cache_context_t * Line 617  GtkWidget *cache_notes(cache_context_t *
617    /* -------------- custom coordinate ---------------- */    /* -------------- custom coordinate ---------------- */
618    
619    GtkWidget *table = gtk_table_new(2, 4, FALSE);    GtkWidget *table = gtk_table_new(2, 4, FALSE);
620    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
621    gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16);    gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16);
622    gtk_table_set_col_spacing(GTK_TABLE(table), 2, 16);    gtk_table_set_col_spacing(GTK_TABLE(table), 2, 16);
623    #endif
624    
625    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
626                      gtk_label_new(_("New coordinate:")), 0, 1, 0, 1);                      gtk_label_new(_("New coordinate:")), 0, 1, 0, 1);
627    context->notes.overridew = gtk_check_button_new_with_label(_("Override"));    context->notes.overridew = check_button_new_with_label(_("Override"));
628    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context->notes.overridew),    check_button_set_active(context->notes.overridew,
629                                 cache->notes && cache->notes->override);                            cache->notes && cache->notes->override);
630    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
631                              context->notes.overridew, 0, 1, 1, 2);                              context->notes.overridew, 0, 1, 1, 2);
632    
633    GtkWidget *hbox = gtk_hbox_new(FALSE, 2);    GtkWidget *hbox = gtk_hbox_new(FALSE, 2);
634    
635    context->notes.foundw = gtk_check_button_new_with_label(_("Found"));    context->notes.foundw = check_button_new_with_label(_("Found"));
636    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context->notes.foundw),    check_button_set_active(context->notes.foundw,
637                                 cache->notes && cache->notes->found);                            cache->notes && cache->notes->found);
638    gtk_box_pack_start_defaults(GTK_BOX(hbox), context->notes.foundw);    gtk_box_pack_start_defaults(GTK_BOX(hbox), context->notes.foundw);
639    
640    context->notes.loggedw = gtk_check_button_new_with_label(_("Logged"));    context->notes.loggedw = check_button_new_with_label(_("Logged"));
641    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context->notes.loggedw),    check_button_set_active(context->notes.loggedw,
642                                 cache->notes && cache->notes->logged);                            cache->notes && cache->notes->logged);
643    gtk_box_pack_start_defaults(GTK_BOX(hbox), context->notes.loggedw);    gtk_box_pack_start_defaults(GTK_BOX(hbox), context->notes.loggedw);
644    
645    gtk_table_attach_defaults(GTK_TABLE(table), hbox, 3, 4, 0, 1);    gtk_table_attach_defaults(GTK_TABLE(table), hbox, 3, 4, 0, 1);
# Line 563  GtkWidget *cache_notes(cache_context_t * Line 651  GtkWidget *cache_notes(cache_context_t *
651      gtk_widget_set_sensitive(context->notes.foundw, FALSE);      gtk_widget_set_sensitive(context->notes.foundw, FALSE);
652    
653    context->notes.datew = gtk_label_new("");    context->notes.datew = gtk_label_new("");
654    gtk_misc_set_alignment(GTK_MISC(context->notes.datew), 0.0f, 0.5f);    gtk_misc_set_alignment(GTK_MISC(context->notes.datew), 0.5f, 0.5f);
655    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
656                              context->notes.datew, 3, 4, 1, 2);                              context->notes.datew, 3, 4, 1, 2);
657    ftime_update(context->notes.foundw, context, FALSE);    ftime_update(context->notes.foundw, context, FALSE);
# Line 573  GtkWidget *cache_notes(cache_context_t * Line 661  GtkWidget *cache_notes(cache_context_t *
661    
662    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
663              context->notes.latw = lat_entry_new(pos.lat), 2, 3, 0, 1);              context->notes.latw = lat_entry_new(pos.lat), 2, 3, 0, 1);
664      g_signal_connect(G_OBJECT(context->notes.latw), "focus-out-event",
665                       G_CALLBACK(focus_out), context);
666    
667    gtk_table_attach_defaults(GTK_TABLE(table),    gtk_table_attach_defaults(GTK_TABLE(table),
668              context->notes.lonw = lon_entry_new(pos.lon), 2, 3, 1, 2);              context->notes.lonw = lon_entry_new(pos.lon), 2, 3, 1, 2);
669      g_signal_connect(G_OBJECT(context->notes.lonw), "focus-out-event",
670                       G_CALLBACK(focus_out), context);
671    
672    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
673    hbox = gtk_hbox_new(FALSE, 0);    hbox = gtk_hbox_new(FALSE, 0);
674    gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
675    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
676    #else
677      gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
678    #endif
679    
680  #ifndef USE_PANNABLE_AREA  #ifndef USE_PANNABLE_AREA
681    GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);    GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);
# Line 594  GtkWidget *cache_notes(cache_context_t * Line 690  GtkWidget *cache_notes(cache_context_t *
690    if(cache->notes && cache->notes->text)    if(cache->notes && cache->notes->text)
691      gtk_text_buffer_set_text(context->notes.buffer, cache->notes->text, -1);      gtk_text_buffer_set_text(context->notes.buffer, cache->notes->text, -1);
692    
693  #ifndef USE_MAEMO  #ifndef USE_HILDON_TEXT_VIEW
694    GtkWidget *view = gtk_text_view_new_with_buffer(context->notes.buffer);    GtkWidget *view = gtk_text_view_new_with_buffer(context->notes.buffer);
695  #else  #else
696    GtkWidget *view = hildon_text_view_new();    GtkWidget *view = hildon_text_view_new();
697    hildon_text_view_set_buffer(HILDON_TEXT_VIEW(view), context->notes.buffer);    hildon_text_view_set_buffer(HILDON_TEXT_VIEW(view), context->notes.buffer);
698  #endif  #endif
699    
700      /* if the cache has been marked found in the logs already, there's */
701      /* no need/use to be able to change all this */
702      if(cache->found) {
703        gtk_widget_set_sensitive(table, FALSE);
704        gtk_widget_set_sensitive(view, FALSE);
705      }
706    
707    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(view), GTK_WRAP_WORD);    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(view), GTK_WRAP_WORD);
708    gtk_text_view_set_editable(GTK_TEXT_VIEW(view), TRUE);    gtk_text_view_set_editable(GTK_TEXT_VIEW(view), TRUE);
709    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(view), 2 );    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(view), 2 );
# Line 612  GtkWidget *cache_notes(cache_context_t * Line 715  GtkWidget *cache_notes(cache_context_t *
715    gtk_text_buffer_set_rich_text_format(context->notes.buffer, "RTF" );    gtk_text_buffer_set_rich_text_format(context->notes.buffer, "RTF" );
716  #endif  #endif
717    
718    #ifndef NO_COPY_N_PASTE
719    g_signal_connect(G_OBJECT(view), "focus-in-event",    g_signal_connect(G_OBJECT(view), "focus-in-event",
720                     G_CALLBACK(focus_in), appdata);                     G_CALLBACK(focus_in), context->appdata);
721    g_signal_connect(G_OBJECT(view), "destroy",    g_signal_connect(G_OBJECT(view), "destroy",
722                     G_CALLBACK(on_destroy_textview), appdata);                     G_CALLBACK(on_destroy_textview), context->appdata);
723    #endif
724    
725  #ifndef USE_PANNABLE_AREA  #ifndef USE_PANNABLE_AREA
726    gtk_container_add(GTK_CONTAINER(scrolled_window), view);    gtk_container_add(GTK_CONTAINER(scrolled_window), view);
# Line 657  void notes_free(notes_t *notes) { Line 762  void notes_free(notes_t *notes) {
762    
763  pos_t notes_get_pos(cache_context_t *context) {  pos_t notes_get_pos(cache_context_t *context) {
764    pos_t pos = context->cache->pos;    pos_t pos = context->cache->pos;
765    if(gtk_toggle_button_get_active(    if(check_button_get_active(context->notes.overridew)) {
766                   GTK_TOGGLE_BUTTON(context->notes.overridew))) {      pos.lat = lat_entry_get(context->notes.latw);
767      pos.lat = lat_get(context->notes.latw);      pos.lon = lon_entry_get(context->notes.lonw);
     pos.lon = lon_get(context->notes.lonw);  
768    }    }
769    return pos;    return pos;
770  }  }
771    
772  gboolean notes_get_override(cache_context_t *context) {  gboolean notes_get_override(cache_context_t *context) {
773    /* get override value */    /* get override value */
774    return gtk_toggle_button_get_active(    return check_button_get_active(context->notes.overridew);
                       GTK_TOGGLE_BUTTON(context->notes.overridew));  
   
775  }  }
776    
777  typedef struct {  typedef struct {
# Line 821  void notes_log_export(appdata_t *appdata Line 923  void notes_log_export(appdata_t *appdata
923    GtkWidget *label = gtk_label_new(_("Export to:"));    GtkWidget *label = gtk_label_new(_("Export to:"));
924    gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE,0);    gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE,0);
925    gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);    gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);
926    GtkWidget *button = gtk_button_new_with_label(_("Browse..."));    GtkWidget *button = gtk_button_new_with_label(_("Browse"));
927    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
928      hildon_gtk_widget_set_theme_size(button,
929               (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
930    #endif
931    gtk_signal_connect(GTK_OBJECT(button), "clicked",    gtk_signal_connect(GTK_OBJECT(button), "clicked",
932                       GTK_SIGNAL_FUNC(on_browse), (gpointer)&context);                       GTK_SIGNAL_FUNC(on_browse), (gpointer)&context);
933    gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE,0);    gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE,0);
# Line 941  void notes_log_export(appdata_t *appdata Line 1047  void notes_log_export(appdata_t *appdata
1047          ccontext.appdata = appdata;          ccontext.appdata = appdata;
1048          ccontext.cache = llog->cache;          ccontext.cache = llog->cache;
1049    
1050          notes_save(&ccontext,          notes_write_file(&ccontext,
1051                     llog->cache->notes->text, llog->cache->notes->pos,                     llog->cache->notes->text, llog->cache->notes->pos,
1052                     llog->cache->notes->override, llog->cache->notes->found,                     llog->cache->notes->override, llog->cache->notes->found,
1053                     llog->cache->notes->ftime, llog->cache->notes->logged);                     llog->cache->notes->ftime, llog->cache->notes->logged);

Legend:
Removed from v.1  
changed lines
  Added in v.221