# testgtkcrystalviewer.c

Go to the documentation of this file.

    00001 #include <gcu/gtkcrystalviewer.h>
    00002 #include <gcu/chemistry.h>
    00003 #include <glib.h>
    00004 #include <gtk/gtk.h>
    00005 #include <stdio.h>
    00006 #include <libxml/parser.h>
    00007
    00021 int main (int argc, char *argv[])
    00022 {
    00023         GtkWidget *window;
    00024         GtkWidget *viewer;
    00025         const char* filename;
    00026         xmlDocPtr xml;
    00027         gtk_init (&argc, &argv);
    00028
    00029         gcu_element_load_databases ("radii", NULL);
    00030
    00031         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    00032         gtk_window_set_title (GTK_WINDOW (window), "GtkCrystalViewer test");
    00033         g_signal_connect (G_OBJECT (window), "destroy",
    00034                  G_CALLBACK (gtk_main_quit),
    00035                  NULL);
    00036
    00037         if (argc >= 2)
    00038                 filename = argv[1];
    00039         else
    00040                 filename = SRCDIR"/nickel.gcrystal";
    00041         xml = xmlParseFile (filename);
    00042
    00043         viewer = gtk_crystal_viewer_new (xml->children);
    00044         gtk_container_add (GTK_CONTAINER (window), viewer);
    00045         gtk_widget_show_all (window);
    00046
    00047         gtk_main ();
    00048
    00049         return 0;
    00050 }