Using the PonG library

The Hello World of PonG

The simplest use of PonG could be illustrated in the following, it will just load the dialog box upon loading. It will however run until it is stopped by ^C from the terminal as there is no controlling window.

Example 1. Hello world of PonG

#include <config.h>
#include <gnome.h>
#include <gconf/gconf-client.h>
#include <pong/pong.h>

main (int argc, char **argv)
	GError *error;

        /* Initialize the i18n stuff */
        bindtextdomain (PACKAGE, GNOMELOCALEDIR);
        textdomain (PACKAGE);

	/* Initialize GNOME */
	gnome_init ("hello-world-pong", VERSION, argc, argv);

	/* Initialize GConf */
	if ( ! gconf_init (argc, argv, &error)) {
		g_assert (error != NULL);
		g_warning (_("GConf init failed:\n  %s"), error->str);
		gconf_error_destroy (error);
		error = NULL;
		return 1;

	/* Initialize PonG */
	if ( ! pong_init ()) {
		g_warning (_("PonG init failed"));
		return 1;

	/* Add a directory for where to look for .pong files */
	pong_add_directory ("/path/where/we/were/installed");

	/* Create a our dialog */
	widget = pong_run_simple_dialog ("hello-world-pong.pong");

	gtk_main ();

	return 0;

As you can see the majority of code is spent not with PonG specific stuff. The only relevant calls are pong_init, pong_add_directory and pong_run_simple_dialog.