Diff of /trunk/src/notes.c

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

revision 233 by harbaum, Wed Dec 9 19:45:36 2009 UTC revision 259 by harbaum, Sat May 15 12:27:40 2010 UTC
# Line 19  Line 19 
19    
20  #include <stdio.h>  #include <stdio.h>
21  #include <string.h>  #include <string.h>
22    #include <errno.h>
23    
24  #include <glib/gunicode.h>  #include <glib/gunicode.h>
25    
# Line 632  GtkWidget *cache_notes(cache_context_t * Line 633  GtkWidget *cache_notes(cache_context_t *
633    pos_t pos = gpx_cache_pos(cache);    pos_t pos = gpx_cache_pos(cache);
634    if(cache->notes) pos = cache->notes->pos;    if(cache->notes) pos = cache->notes->pos;
635    
636    gtk_table_attach_defaults(GTK_TABLE(table),    context->notes.latw = lat_entry_new(pos.lat);
637              context->notes.latw = lat_entry_new(pos.lat), 0, 1, 1, 2);    context->notes.lonw = lon_entry_new(pos.lon);
638      GtkWidget *picker =
639        preset_coordinate_picker(context->appdata,
640                                 context->notes.latw, context->notes.lonw);
641    
642    g_signal_connect(G_OBJECT(context->notes.latw), "focus-out-event",    g_signal_connect(G_OBJECT(context->notes.latw), "focus-out-event",
643                     G_CALLBACK(focus_out), context);                     G_CALLBACK(focus_out), context);
   
   gtk_table_attach_defaults(GTK_TABLE(table),  
             context->notes.lonw = lon_entry_new(pos.lon), 2, 3, 1, 2);  
644    g_signal_connect(G_OBJECT(context->notes.lonw), "focus-out-event",    g_signal_connect(G_OBJECT(context->notes.lonw), "focus-out-event",
645                     G_CALLBACK(focus_out), context);                     G_CALLBACK(focus_out), context);
646    
647    
648      GtkWidget *ihbox = gtk_hbox_new(FALSE, 0);
649    
650      gtk_box_pack_start_defaults(GTK_BOX(ihbox), context->notes.latw);
651      gtk_box_pack_start_defaults(GTK_BOX(ihbox), context->notes.lonw);
652      gtk_box_pack_start_defaults(GTK_BOX(ihbox), picker);
653    
654      gtk_table_attach_defaults(GTK_TABLE(table),
655                                ihbox, 0, 3, 1, 2);
656    
657  #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)  #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
658    hbox = gtk_hbox_new(FALSE, 0);    hbox = gtk_hbox_new(FALSE, 0);
659    gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 0);
# Line 866  void notes_log_export(appdata_t *appdata Line 878  void notes_log_export(appdata_t *appdata
878      time_t now = time(NULL);      time_t now = time(NULL);
879      struct tm *tm_now = localtime(&now);      struct tm *tm_now = localtime(&now);
880      char now_str[32];      char now_str[32];
881      strftime(now_str, sizeof(now_str)-1, "%F_%H:%M", tm_now);      strftime(now_str, sizeof(now_str)-1, "%F_%H-%M", tm_now);
882      char *fname = g_strdup_printf(appdata->fieldnotes_path, now_str);      char *fname = g_strdup_printf(appdata->fieldnotes_path, now_str);
883    
884      printf("--- about to export logs to %s ---\n", fname);      printf("--- about to export logs to %s ---\n", fname);
885      FILE *file = fopen(fname, "w");      FILE *file = fopen(fname, "w");
886      g_free(fname);      g_free(fname);
887    
888      if(file) {      if(file) {
   
889        llog = log;        llog = log;
890        while(llog) {        while(llog) {
891          printf("Exporting %s\n", llog->cache->id);          printf("Exporting %s\n", llog->cache->id);
# Line 963  void notes_log_export(appdata_t *appdata Line 975  void notes_log_export(appdata_t *appdata
975        }        }
976    
977        fclose(file);        fclose(file);
978      }      } else
979          errorf(_("Can't open file:\n\n%s"), strerror(errno));
980    
981    } else {    } else {
982      /* restore old path, in case it has been altered but not been used */      /* restore old path, in case it has been altered but not been used */
983      free(appdata->fieldnotes_path);      free(appdata->fieldnotes_path);

Legend:
Removed from v.233  
changed lines
  Added in v.259