testgtkcrystalviewer.c

Go to the documentation of this file.
00001 /* 
00002  * Gnome Chemisty Utils
00003  * testgtkcrystalviewer.c 
00004  *
00005  * Copyright (C) 2006 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 <gcu/gtkcrystalviewer.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 
00033 int main(int argc, char *argv[])
00034 {
00035         GtkWidget *window;
00036         GtkWidget *viewer;
00037         const char* filename;
00038         xmlDocPtr xml;
00039         gtk_init (&argc, &argv);
00040         
00041         gcu_element_load_databases ("radii", NULL);
00042 
00043         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
00044         gtk_window_set_title(GTK_WINDOW(window), "GtkCrystalViewer test");
00045         g_signal_connect(GTK_OBJECT(window), "destroy",
00046                  GTK_SIGNAL_FUNC(gtk_main_quit),
00047                  NULL);
00048 
00049         if (argc >= 2) filename = argv[1];
00050                 else filename = "nickel.gcrystal";
00051         xml = xmlParseFile(filename);
00052         
00053         viewer = gtk_crystal_viewer_new(xml->children);
00054         gtk_container_add(GTK_CONTAINER(window), viewer);
00055         gtk_widget_show_all(window);
00056 
00057         gtk_main();
00058         
00059         return(0);
00060 }

Generated on Mon May 7 16:57:26 2007 for The Gnome Chemistry Utils by  doxygen 1.5.1