[Glade-users] Making my own Classes



Hi,

I've questions to make my own widget library using glade, it's for
libempathy-gtk, I want to know the best way for doing that.

For example I have a glade file with a GtkHBox as root and many other
widgets packed in it. So I can load that GtkHBox and do things with
widgets packed...

But I would like to have my own EmpathyFoo class inheriting from GtkHBox
to add some properties.

If I manually modify the glade file to change the type of the root
widget from GtkHBox to EmpathyFoo, then I can write a empathy_foo_new()
function that loads the glade and get the root object, which will make
glade to call my constructor function and pack all widgets in it, I
didn't tested that yet but it should work I hope.

But how will glade-3 react if I want to edit my glade file? It will see
a unknown widget type... Is there a way to tell glade that EmpathyFoo is
just like GtkHBox but when a client wants to instantiate it should use
g_object_new(Empathy_foo_get_type(), NULL);

And if I write a catalog xml file to describe properties of my
EmpathyFoo widget, then other programs will be able to embed a
EmpathyFoo widget in their UI, but will they be able to modify widgets
packed in it?

So I have a foo.glade describing my EmpathyFoo widget, if I edit that
file I want to be able to modify widgets packed in my EmpathyFoo widget.
If a create a new bar.glade and pack (using catalog) an EmpathyFoo
widget into a GtkWindow I don't want to be able to edit widgets
contained in EmpathyFoo widget.

Is that possible? Thanks for explanations!

Xavier Claessens.





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