The Gnome Chemistry Utils  0.14.0
testgcuchem3dviewer.c
Go to the documentation of this file.
1 /*
2  * Gnome Chemisty Utils
3  * tests/testgcuchem3dviewer.c
4  *
5  * Copyright (C) 2008-2011 Jean Bréfort <jean.brefort@normalesup.org>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22 
23 #include "config.h"
24 #include <gcu/chemistry.h>
25 #include <gcugtk/gcuchem3dviewer.h>
26 #include <glib.h>
27 #include <gtk/gtk.h>
28 #include <stdio.h>
29 
43 int main (int argc, char *argv[])
44 {
45  GtkWidget *window;
46  GtkWidget *viewer;
47  gchar* uri;
48  gtk_init (&argc, &argv);
49 
50  gcu_element_load_databases ("radii", NULL);
51 
52  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
53  gtk_window_set_title (GTK_WINDOW (window), "GcuChem3dViewer test");
54  g_signal_connect (G_OBJECT (window), "destroy",
55  G_CALLBACK (gtk_main_quit),
56  NULL);
57 
58  if (argc >= 2)
59  uri = argv[1];
60  else
61  uri = "file://"SRCDIR"/methane.xyz";
62 
63  viewer = gcu_chem3d_viewer_new (uri);
64  gtk_container_add (GTK_CONTAINER (window), viewer);
65  gtk_widget_show_all (window);
66 
67  gtk_main ();
68 
69  return 0;
70 }