int main(int argc, char *argv[]) { Tree tree; tree = TreeRead(stdin, RealRead); if(!tree) exit(0); TreeSimplify(tree, GenericFree); TreeWrite(stdout, tree, RealWrite); exit(0); }
void menuOpenData(GtkMenuItem* item, gpointer data) { GtkWidget* d; gchar* path = NULL; FILE* f; gchar* err = NULL; gchar* title; geoData = NULL; d = gtk_file_chooser_dialog_new("Open Data", GTK_WINDOW(data), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT) { path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(d)); } gtk_widget_destroy(d); if (path == NULL) { return; } g_chdir(path); g_free(path); f = fopen("records.csv", "r"); geoData = BioGeoRead(f, &err); fclose(f); if (err != NULL) { errMsg(GTK_WINDOW(data), err); g_free(err); return; } f = fopen("trees.csv", "r"); treeData = TreeRead(f, &err); fclose(f); if (err != NULL) { errMsg(GTK_WINDOW(data), err); g_free(err); return; } PrepareTrees(treeData, geoData); changeTree(g_ptr_array_index(treeData, 0)); gtk_widget_set_sensitive(GTK_WIDGET(item), FALSE); gtk_widget_set_sensitive(itemRecons, TRUE); title = g_strdup_printf("ev.view: %s", activeTree->ID); gtk_window_set_title(GTK_WINDOW(data), title); g_free(title); }