> I'm considering using Glade in a project I'm working on. I've played around
> with it enough to generate a moderately interesting window o' widgets, build
> the source code from that, and run the executable.

The approach you want to use, is the same I am using in Gnumeric:

    1. You use Glade to generate the user interface, and you save your
       dialog boxes into a .glade file.

    2. You use libglade to load at runtime the user interface (this
       pulls the widget structure from the .glade file and recreates
       the widgets).

       Libglade has 2 API entry points: glade_xml_new and
       glade_xml_get_widget.  

       You load your user interface with the former.

       glade_xml_new ("my-gui.glade");

       I personally use:

         GladeXML *gui;

         gui = glade_xml_new (APPLICATION_GLADE_DIR "/mygui.glade");
         if (!gui){
            error;
         }

    3. Then, to configure, modify, hook up, monitor (trough signals)
       or any other tweaking you might want to do, you use
       glade_xml_get_widget.

       For example, to connect to the "clicked" signal, you do:

                button = glade_xml_get_widget (gui, "ok-button");

                gtk_signal_connect (button, "clicked",
                                    GTK_SIGNAL_FUNC(ok_clicked),
                                    NULL);

       In my Makefile.am I put:

          gladedir = $(datadir)/myapp/glade
          glade_DATA = mygui.glade

       [This takes care of installing the file in the proper
       directory]

       And I add to my INCLUDES:

           -DAPPLICATION_GLADE_DIR=\""$(gladedir)"\"

       To pass the install path to the application.

    You can see more examples of this in the Gnumeric source code,
specially in gnumeric/src/dialogs/ directory.

best wishes,
Miguel.


+---------------------------------------------------------------------+
To unsubscribe from this list, send a message to [EMAIL PROTECTED]
with the line "unsubscribe glade-devel" in the body of the message.

Reply via email to