Diff of /trunk/src/main.c

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

revision 74 by harbaum, Mon Aug 24 09:23:36 2009 UTC revision 120 by harbaum, Sat Sep 19 19:19:42 2009 UTC
# Line 138  gpx_t *choose_file(appdata_t *appdata, g Line 138  gpx_t *choose_file(appdata_t *appdata, g
138    gtk_widget_show_all (GTK_WIDGET(dialog));    gtk_widget_show_all (GTK_WIDGET(dialog));
139    if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) {    if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) {
140      char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));      char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
141    
142        if(filename) {
143          gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));
144    
145      gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));        if(!whole_dir)
146            gpx = gpx_parse(dialog, filename);
147      if(!whole_dir)        else {
148        gpx = gpx_parse(dialog, filename);          /* cur trailing '/' if present */
149      else {          if(strlastchr(filename) == '/')
150        /* cur trailing '/' if present */            filename[strlen(filename)] = 0;
151        if(strlastchr(filename) == '/')  
152          filename[strlen(filename)] = 0;          gpx = gpx_parse_dir(dialog, filename);
   
       gpx = gpx_parse_dir(dialog, filename);  
     }  
   
     gpx_busy_dialog_destroy(dialog);  
   
     /* save path if gpx was successfully loaded */  
     if(gpx) {  
       char *r = strrchr(filename, '/');  
   
       /* there is a delimiter, use everything left of it as path */  
       if(r && !whole_dir) {  
         *r = 0;  
         if(appdata->path) free(appdata->path);  
         appdata->path = strdup(filename);  
         /* restore path ... just in case ... */  
         *r = '/';  
153        }        }
154    
155          gpx_busy_dialog_destroy(dialog);
156    
157          /* save path if gpx was successfully loaded */
158          if(gpx) {
159            char *r = strrchr(filename, '/');
160    
161            /* there is a delimiter, use everything left of it as path */
162            if(r && !whole_dir) {
163              *r = 0;
164              if(appdata->path) free(appdata->path);
165              appdata->path = strdup(filename);
166              /* restore path ... just in case ... */
167              *r = '/';
168            }
169    
170            if(whole_dir)
171              appdata->path = strdup(filename);
172          } else
173            errorf(_("Load error"));
174    
175        if(whole_dir)        g_free (filename);
176          appdata->path = strdup(filename);      } else {
177      } else  #ifndef USE_MAEMO
178        errorf(_("Load error"));        errorf(_("Error accessing the file."));
179    #else
180      g_free (filename);        errorf(_("Error accessing the file. This may happen if the file "
181                   "resides on a remote file system. Please copy the file onto "
182                   "the device (e.g. onto the memory card) and try again."));
183    #endif
184        }
185    }    }
186    
187    gtk_widget_destroy (dialog);    gtk_widget_destroy (dialog);
# Line 967  static GtkWidget *gpxlist_create_view_an Line 977  static GtkWidget *gpxlist_create_view_an
977    GtkTreeIter sel_iter;    GtkTreeIter sel_iter;
978    gboolean sel_iter_valid = FALSE;    gboolean sel_iter_valid = FALSE;
979    while(gpx) {    while(gpx) {
980      /* don't display entries that failed at load */      GtkTreeIter         iter;
981      if(!gpx->failed) {      gtk_list_store_append(appdata->gpxstore, &iter);
982        GtkTreeIter         iter;      gpxlist_set(appdata->gpxstore, &iter, gpx);
983        gtk_list_store_append(appdata->gpxstore, &iter);  
984        gpxlist_set(appdata->gpxstore, &iter, gpx);      if(gpx == sel_gpx) {
985          sel_iter = iter;
986        if(gpx == sel_gpx) {        sel_iter_valid = TRUE;
         sel_iter = iter;  
         sel_iter_valid = TRUE;  
       }  
987      }      }
988    
989      gpx = gpx->next;      gpx = gpx->next;
# Line 1752  HildonAppMenu *menu_create(appdata_t *ap Line 1759  HildonAppMenu *menu_create(appdata_t *ap
1759    hildon_app_menu_append(menu, GTK_BUTTON(button));    hildon_app_menu_append(menu, GTK_BUTTON(button));
1760    
1761  #ifdef ENABLE_OSM_GPS_MAP  #ifdef ENABLE_OSM_GPS_MAP
   if((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST)) {  
1762      button = gtk_button_new_with_label(_("Map"));      button = gtk_button_new_with_label(_("Map"));
1763      g_signal_connect_after(button, "clicked",      g_signal_connect_after(button, "clicked",
1764                             G_CALLBACK(cb_menu_map), appdata);                             G_CALLBACK(cb_menu_map), appdata);
1765      hildon_app_menu_append(menu, GTK_BUTTON(button));      hildon_app_menu_append(menu, GTK_BUTTON(button));
   }  
1766  #endif  #endif
1767    
1768  #ifdef HILDON_HELP  #ifdef HILDON_HELP

Legend:
Removed from v.74  
changed lines
  Added in v.120