testgtkchem3dviewer.c

Go to the documentation of this file.
00001 /* 
00002  * Gnome Chemisty Utils
00003  * tests/testgtkchem3dviewer.c 
00004  *
00005  * Copyright (C) 2008 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 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 #ifdef GOFFICE_IS_0_6
00030 #       include <libgnomevfs/gnome-vfs.h>
00031 #endif
00032 
00046 int main (int argc, char *argv[])
00047 {
00048         GtkWidget *window;
00049         GtkWidget *viewer;
00050         gchar* uri;
00051         gtk_init (&argc, &argv);
00052 #ifdef GOFFICE_IS_0_6
00053         if (!gnome_vfs_init ()) {
00054                 printf ("Could not initialize GnomeVFS\n");
00055                 return 1;
00056         }
00057 #endif
00058         
00059         gcu_element_load_databases ("radii", NULL);
00060 
00061         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
00062         gtk_window_set_title (GTK_WINDOW (window), "GtkChem3dViewer test");
00063         g_signal_connect (G_OBJECT (window), "destroy",
00064                  G_CALLBACK (gtk_main_quit),
00065                  NULL);
00066 
00067         if (argc >= 2)
00068                 uri = argv[1];
00069         else
00070                 uri = "file://"SRCDIR"/methane.xyz";
00071         
00072         viewer = gtk_chem3d_viewer_new (uri);
00073         gtk_container_add (GTK_CONTAINER (window), viewer);
00074         gtk_widget_show_all (window);
00075 
00076         gtk_main ();
00077         
00078         return 0;
00079 }
Generated by  doxygen 1.6.2-20100208