Diff of /trunk/src/main.c

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

revision 49 by harbaum, Mon Aug 10 19:48:51 2009 UTC revision 113 by harbaum, Wed Sep 16 13:45:10 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    #ifndef USE_MAEMO
178          errorf(_("Error accessing the file."));
179    #else
180          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      }      }
   
     g_free (filename);  
185    }    }
186    
187    gtk_widget_destroy (dialog);    gtk_widget_destroy (dialog);
# Line 969  static GtkWidget *gpxlist_create_view_an Line 980  static GtkWidget *gpxlist_create_view_an
980      GtkTreeIter         iter;      GtkTreeIter         iter;
981      gtk_list_store_append(appdata->gpxstore, &iter);      gtk_list_store_append(appdata->gpxstore, &iter);
982      gpxlist_set(appdata->gpxstore, &iter, gpx);      gpxlist_set(appdata->gpxstore, &iter, gpx);
983    
984      if(gpx == sel_gpx) {      if(gpx == sel_gpx) {
985        sel_iter = iter;        sel_iter = iter;
986        sel_iter_valid = TRUE;        sel_iter_valid = TRUE;
# Line 1077  cb_menu_about(GtkWidget *window, gpointe Line 1088  cb_menu_about(GtkWidget *window, gpointe
1088    
1089    GtkWidget *hbox = gtk_hbox_new(FALSE, 8);    GtkWidget *hbox = gtk_hbox_new(FALSE, 8);
1090    gtk_box_pack_start(GTK_BOX(hbox),    gtk_box_pack_start(GTK_BOX(hbox),
1091                       gtk_label_new(_("Do you you ĺike GPXView?")),                       gtk_label_new(_("Do you like GPXView?")),
1092                       FALSE, FALSE, 0);                       FALSE, FALSE, 0);
1093    
1094    GtkWidget *button = gtk_button_new();    GtkWidget *button = gtk_button_new();
# Line 1868  void menu_create(appdata_t *appdata) { Line 1879  void menu_create(appdata_t *appdata) {
1879    
1880    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
1881    
   item = gtk_menu_item_new_with_label(_("Tools"));  
   gtk_menu_append(GTK_MENU_SHELL(menu), item);  
   submenu = gtk_menu_new();  
   gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);  
   
1882  #ifdef ENABLE_OSM_GPS_MAP  #ifdef ENABLE_OSM_GPS_MAP
1883    item = gtk_menu_item_new_with_label( _("Map") );    item = gtk_menu_item_new_with_label( _("Map") );
1884    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1885    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",
1886                     GTK_SIGNAL_FUNC(cb_menu_map), appdata);                     GTK_SIGNAL_FUNC(cb_menu_map), appdata);
1887  #endif  #endif
1888    
1889      item = gtk_menu_item_new_with_label(_("Tools"));
1890      gtk_menu_append(GTK_MENU_SHELL(menu), item);
1891      submenu = gtk_menu_new();
1892      gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
1893    
1894    item = gtk_menu_item_new_with_label( _("Geomath") );    item = gtk_menu_item_new_with_label( _("Geomath") );
1895    gtk_menu_append(GTK_MENU_SHELL(submenu), item);    gtk_menu_append(GTK_MENU_SHELL(submenu), item);
1896    g_signal_connect(item, "activate",    g_signal_connect(item, "activate",

Legend:
Removed from v.49  
changed lines
  Added in v.113