/** * open an existing project from a file. */ static int project_open( char *filename ) { Ewler_Project *p; p = project_copy(); if( !p ) { ewler_error("project_open: out of memory!"); return -1; } active_project->filename = strdup(filename); active_project->files = ecore_hash_new(ecore_str_hash, ecore_str_compare); if( file_project_open(active_project) == 0 ) { project_close(p); active_project->dirty = false; active_project->ever_saved = true; project_update(); } else { project_close(active_project); active_project = p; ewler_error("Unable to open project file: %s", active_project->filename); return -1; } return 0; }
G_MODULE_EXPORT void on_menu_projclose_activate (GtkWidget *widget, void *user) { if (!gummi->project->projfile) return; if (project_close ()) { projectgui_disable (gummi->project, gui->projectgui); } }
/* checks whether there is an already open project and asks the user if he wants to close it or * abort the current action. Returns FALSE when the current action(the caller) should be cancelled * and TRUE if we can go ahead */ gboolean project_ask_close(void) { if (app->project != NULL) { if (dialogs_show_question_full(NULL, GTK_STOCK_CLOSE, GTK_STOCK_CANCEL, _("Do you want to close it before proceeding?"), _("The '%s' project is open."), app->project->name)) { project_close(FALSE); return TRUE; } else return FALSE; } else return TRUE; }