# testgtkchem3dviewer.c

Go to the documentation of this file.

    00001 #include "config.h"
    00002 #include <gcu/chemistry.h>
    00003 #include <gcu/gtkchem3dviewer.h>
    00004 #include <glib.h>
    00005 #include <gtk/gtk.h>
    00006 #include <stdio.h>
    00007 #ifdef GOFFICE_IS_0_6
    00008 #       include <libgnomevfs/gnome-vfs.h>
    00009 #endif
    00010
    00024 int main (int argc, char *argv[])
    00025 {
    00026         GtkWidget *window;
    00027         GtkWidget *viewer;
    00028         gchar* uri;
    00029         gtk_init (&argc, &argv);
    00030 #ifdef GOFFICE_IS_0_6
    00031         if (!gnome_vfs_init ()) {
    00032                 printf ("Could not initialize GnomeVFS\n");
    00033                 return 1;
    00034         }
    00035 #endif
    00036
    00037         gcu_element_load_databases ("radii", NULL);
    00038
    00039         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    00040         gtk_window_set_title (GTK_WINDOW (window), "GtkChem3dViewer test");
    00041         g_signal_connect (G_OBJECT (window), "destroy",
    00042                  G_CALLBACK (gtk_main_quit),
    00043                  NULL);
    00044
    00045         if (argc >= 2)
    00046                 uri = argv[1];
    00047         else
    00048                 uri = "file://"SRCDIR"/methane.xyz";
    00049
    00050         viewer = gtk_chem3d_viewer_new (uri);
    00051         gtk_container_add (GTK_CONTAINER (window), viewer);
    00052         gtk_widget_show_all (window);
    00053
    00054         gtk_main ();
    00055
    00056         return 0;
    00057 }