The Gnome Chemistry Utils 0.13.3
|
00001 /* 00002 * Gnome Chemisty Utils 00003 * tests/testgcucrystalviewer.c 00004 * 00005 * Copyright (C) 2008-2010 Jean Bréfort <jean.brefort@normalesup.org> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License as 00009 * published by the Free Software Foundation; either version 2 of the 00010 * License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00020 * USA 00021 */ 00022 00023 #include <gcr/gcrcrystalviewer.h> 00024 #include <gcu/chemistry.h> 00025 #include <glib.h> 00026 #include <gtk/gtk.h> 00027 #include <stdio.h> 00028 #include <libxml/parser.h> 00029 00043 int main (int argc, char *argv[]) 00044 { 00045 GtkWidget *window; 00046 GtkWidget *viewer; 00047 const char* filename; 00048 xmlDocPtr xml; 00049 gtk_init (&argc, &argv); 00050 00051 gcu_element_load_databases ("radii", NULL); 00052 00053 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 00054 gtk_window_set_title (GTK_WINDOW (window), "GcuCrystalViewer test"); 00055 g_signal_connect (G_OBJECT (window), "destroy", 00056 G_CALLBACK (gtk_main_quit), 00057 NULL); 00058 00059 if (argc >= 2) 00060 filename = argv[1]; 00061 else 00062 filename = SRCDIR"/nickel.gcrystal"; 00063 xml = xmlParseFile (filename); 00064 00065 viewer = gcr_crystal_viewer_new (xml->children); 00066 gtk_container_add (GTK_CONTAINER (window), viewer); 00067 gtk_widget_show_all (window); 00068 00069 gtk_main (); 00070 00071 return 0; 00072 }