[Glade-devel] Adding extra properties to widgets



Daniel Kasak wrote:

Greetings.

I'm a Perl developer, and author of a couple of projects that assist in
building database applications with gtk2-perl (
http://entropy.homelinux.org/axis_not_evil ). I'd like to add some
additional properties to glade-3 widgets ( all widgets ) that will
further assist in my projects.

For example, I'm working on some formatting functions that will present
data in a more user-friendly way. So I'd like to add a 'format'
property, and have glade-3 offer a combo with a list of formats ( eg
currency, time, date ... ).

Considering that I don't know any C ( Perl / PHP / VB only ), is this
possible? Can I easily hack this sort of functionality into Glade-3?

 

If you want to add properties to objects built by glade-3; the right
thing to do is write a subclass of the said object and extend it by
adding the said properties.

Doing that will require that you subclass it using C code; since glade-3
needs to instanciate your object at runtime.

I shouldnt mention it but... if you follow the docs here 
http://gnome.org/~tvb/glade_api,
you could modify the gtk+.xml that glade-3 installs by hand and add 
properties,
then you could use some binding to libglade's 
glade_xml_register_custom_prop() api.

That ofcourse, is unsupported but will work; the future is gtk builder; 
and gtk builder
in its current design doesnt allow you to handle custom properties 
unless you are
in the widget class code already (i.e. you must implement 
GtkBuildableIface for your widget).

Cheers,
                                         -Tristan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]