testgtkchem3dviewer.c

Go to the documentation of this file.
00001 /* 
00002  * Gnome Chemisty Utils
00003  * testgtkchem3dviewer.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 "config.h"
00024 #include <gcu/chemistry.h>
00025 #include <gcu/gtkchem3dviewer.h>
00026 #include <glib.h>
00027 #include <gtk/gtk.h>
00028 #include <stdio.h>
00029 #include <libgnomevfs/gnome-vfs.h>
00030 
00034 int main(int argc, char *argv[])
00035 {
00036         GtkWidget *window;
00037         GtkWidget *viewer;
00038         gchar* uri;
00039         gtk_init (&argc, &argv);
00040         if (!gnome_vfs_init ()) {
00041                 printf ("Could not initialize GnomeVFS\n");
00042                 return 1;
00043         }
00044         
00045         gcu_element_load_databases ("radii", NULL);
00046 
00047         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
00048         gtk_window_set_title(GTK_WINDOW(window), "GtkChem3dViewer test");
00049         g_signal_connect(GTK_OBJECT(window), "destroy",
00050                  GTK_SIGNAL_FUNC(gtk_main_quit),
00051                  NULL);
00052 
00053         if (argc >= 2) uri = argv[1];
00054                 else uri = "file://"SRCDIR"/methane.xyz";
00055         
00056         viewer = gtk_chem3d_viewer_new(uri);
00057         gtk_container_add(GTK_CONTAINER(window), viewer);
00058         gtk_widget_show_all(window);
00059 
00060         gtk_main();
00061         
00062         return(0);
00063 }

Generated on Wed Jan 17 23:01:02 2007 for The Gnome Chemistry Utils by  doxygen 1.4.7