Diff of /trunk/src/project.c

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

revision 218 by harbaum, Mon Jul 13 12:15:51 2009 UTC revision 219 by harbaum, Mon Jul 13 14:02:47 2009 UTC
# Line 19  Line 19 
19    
20  /*  /*
21   * TODO:   * TODO:
  * - don't allow user to delete active project. force/request close before  
22   */   */
23    
24  #include "appdata.h"  #include "appdata.h"
# Line 464  static void callback_modified_name(GtkWi Line 463  static void callback_modified_name(GtkWi
463    
464  gboolean project_delete(select_context_t *context, project_t *project) {  gboolean project_delete(select_context_t *context, project_t *project) {
465    
466      /* check if we are to delete the currently open project */
467      if(context->appdata->project &&
468         !strcmp(context->appdata->project->name, project->name)) {
469    
470        if(!yes_no_f(context->dialog, NULL, 0, 0,
471                     _("Delete current project?"),
472                     _("The project you are about to delete is the one "
473                       "you are currently working on!\n\n"
474                       "Do you want to delete it anyway?")))
475          return FALSE;
476    
477        project_close(context->appdata);
478      }
479    
480    /* remove entire directory from disk */    /* remove entire directory from disk */
481    GDir *dir = g_dir_open(project->path, 0, NULL);    GDir *dir = g_dir_open(project->path, 0, NULL);
482    const char *name = NULL;    const char *name = NULL;
# Line 571  project_t *project_new(select_context_t Line 584  project_t *project_new(select_context_t
584    project->osm = g_strdup_printf("%s.osm", project->name);    project->osm = g_strdup_printf("%s.osm", project->name);
585    
586    /* around the castle in karlsruhe, germany ... */    /* around the castle in karlsruhe, germany ... */
587    project->min.lat = 49.005;  project->min.lon = 8.3911;    project->min.lat = NAN;  project->min.lon = NAN;
588    project->max.lat = 49.023;  project->max.lon = 8.4185;    project->max.lat = NAN;  project->max.lon = NAN;
589    
590    /* create project file on disk */    /* create project file on disk */
591    project_save(context->dialog, project);    project_save(context->dialog, project);
# Line 705  static void on_project_edit(GtkButton *b Line 718  static void on_project_edit(GtkButton *b
718          if(appdata->osm) {          if(appdata->osm) {
719            /* redraw the entire map by destroying all map items  */            /* redraw the entire map by destroying all map items  */
720            diff_save(appdata->project, appdata->osm);            diff_save(appdata->project, appdata->osm);
721            map_clear(appdata, MAP_LAYER_OBJECTS_ONLY);            map_clear(appdata, MAP_LAYER_ALL);
722            osm_free(&appdata->icon, appdata->osm);            osm_free(&appdata->icon, appdata->osm);
723    
724            appdata->osm = NULL;            appdata->osm = NULL;

Legend:
Removed from v.218  
changed lines
  Added in v.219