[Glade-devel] Extending libglade with new widgets

Tristan Van Berkom tristan.van.berkom at gmail.com
Sat May 27 13:25:23 EDT 2006


Jeff Westerinen wrote:

>I am trying to learn how to add widgets to Glade and libglade.  I
>followed the GTK+ 2.0 Tutorial and created the tictactoe widget.  I then
>created a widget catalog and installed it, and I'm able to use Glade3 to
>create correct XML that describes a window with a tictactoe widget.
>But, now, I don't understand what I must do to get libglade to recognize
>the widget.  The libglade documentation says you may or may not need a
>"plugin" lib for the widget.  But it also suggests that the actual
>widget code itself can be used by libglade.  One way or another, it
>appears that whatever library is used must have a
>"glade_module_register_widgets()" function.  Does anyone know how this
>all works or can anyone point me to some kind of documentation that
>describes this better?
>  
>
glade_xml_register_widget() must be called on any GType that is
to be built by libglade.

When you create a module in glade-3, the symbolic name is currently
used as a dependancy (notice the <requires> tag in the glade file),
this will trigger libglade to load the coresponding libglade module.

in this libglade module you must call glade_xml_register_widget() and
optionally pass in custom constructors... of you have custom parameters
on your objects (i.e. not installed with g_object_class_install_property()),
then you must call glade_xml_register_custom_prop() for these.

See $(gnomecvs)/libglade/glade/glade-gtk.c for example code.

Cheers,
                                          -Tristan

Note, its been a while since I looked at the libglade module stuff; I'm
sure if you grep around a little you'll find the appropriate install 
prefix and
naming scheme for your libglade module :)



More information about the Glade-devel mailing list