[Glade-devel] libglade help

Hongli Lai h.lai@chello.nl
Tue, 18 Feb 2003 07:53:45 +0100


Robert Parkhurst wrote:

>Hey guys-
>
>Can anyone send a very simplistic program that uses libglade to read
>from and construct a GNOME app?  Preferably a gnome2 app, but gnome1
>will work for now I suppose.
>  
>

1. Create a UI using Glade (I assume you can already do this).
2. Click Save and save it.
3. Sample code to load that Glade file (GNOME 2.0):
#include <glade/glade.h>

int
main (int argc, char *argv[])
{
    GladeXML *xml;

    gnome_init ("MyApp", "1.0", argc, argv);
    /* Load the glade file */
    xml = glade_xml_new ("MyFile.glade", NULL, NULL);
    /* Connect signals to callback functions */
    glade_xml_signal_autoconnect (xml);

    gtk_main ();
    return 0;
}

This code hasn't been tested (I'm in Windows right now).