[Glade-users] i don't get it

Keith Sharp kms@passback.co.uk
Thu, 29 Jan 2004 19:13:15 +0000


On Wed, 2004-01-28 at 20:02, Alef T Veld wrote:
> I'm building my gui with the glade interface designer. Then i just use the .glade file it generates, and remove all
> the crap i don't need.
> 
> Possible i'm removing a bit to much, but i don't understand what's going on here. I get a gazillion errors on startup,
> yet it seems to work fine. However, i now have a new widget added to my table1, with about 10 pages, and it just
> displays the first 2, with wrong labels to.
> 
> I will add the errors i get (sorry if it is to much) and my main.c file i use for program initialization. I hope 
> someone can tell me what to do. 

[ Snip errors ]

> And this, is what i use for the main() code:
> 
> #include "include.h"
> 
> GtkWidget *magellan;    /* Main gnome application window */
> GladeXML *xml;
> 
> int main(int argc,char *argv[])
> {
>         /* initialize gnome */
>         gtk_init(&argc,&argv);

Looking at the errors you are trying to create a GnomeProgram (and I
assume your GladeXML file contains GNOME widgets) so you will need to
initialise GNOME.  Something like:

	GnomeProgram *program;

	program = gnome_program_init (PACKAGE, VERSION,
				LIBGNOMEUI_MODULE,
				argc, argv,
				GNOME_PARAM_NONE);

Have a look at the docs:

http://developer.gnome.org/doc/API/2.0/libgnome/libgnome-gnome-program.html

>         /* initialize glade for gnome */
>         glade_init();

You don't need this anymore, but having will not cause any harm.

>         /* Load widgets from XML file in GladeXML objects */
>         if(!(xml=glade_xml_new("../magellan.glade",NULL,NULL))) {
>         g_warning(".glade not available");
>         exit(1);}
> 
>         /* Autoconnect signals */
>         glade_xml_signal_autoconnect(xml);
> 
>         /* Get our widget pointers from the XML object */
>         magellan=glade_xml_get_widget(xml,"magellan");
> 
> 
>          /* We don't need the GladeXML objects anymore, so
>         //destroy it to save some memory */
>         //gtk_object_unref(GTK_OBJECT(xml));
> 
>         gtk_main();
> 
>         return 0;
> }

If you need more help then you'll have to supply more information.

Keith.