testgcucrystalviewer.c

Go to the documentation of this file.
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 library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library 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 GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this program; if not, write to the 
00019  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00020  * Boston, MA  02110-1301, USA.
00021  */
00022 
00023 #include <gcu/gcucrystalviewer.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 = gcu_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 }

Generated on Fri Sep 24 15:58:42 2010 for The Gnome Chemistry Utils by  doxygen 1.5.9