[Glade-users] Making my own Classes



On Mon, 2007-10-15 at 10:14 +0200, Xavier Claessens wrote:
Ok, with some concrete screenshots it's easier:

[1] That's a EmpathyContactWidget, it's a vbox with lots of things in
it. Atm EmpathyContactWidget is not a subclass of GtkVBox because I
don't know how to do that using glade. 

Ok, well here's the first misunderstanding.

You cannot "use glade to subclass a widget", to create a widget subclass
then you must actually write the widget code.

Once you have a real widget class, then we can integrate it into glade,
glade will not display all of the internal children of your widget
unless we can really get to the type (i.e. either you write a plugin
that links to your empathy library, or you just mention the empathy
library as "library" in the catalog so we can lookup
empathy_contact_widget_get_type()).

You can see the code [2],
especially empathy_contact_widget_new(). What I want is
EmpathyContactWidget to be a subclass of GtkVBox and containing all
internal widgets like in the screenshot. It's easy if all those widgets
are packed in my C code without using a glade file, but I want to use
glade to construct my widgets because it's far easier to make better
looking widgets.

Ok heres where the recursive experimental stuff comes into play,
you are the test subject I'm afraid.

Try this:
your widget library uses either libglade or gtkbuilder to
build its internal widget setup (use the constructor class
method to build the subhierarchy and setup your widget)

then in your glade plugin, you must mark any children that
were created that you want the user to be allowed to change
properties on/add children to.

That should work just fine.

when the application that uses your glade catalog loads
empathy widgets, the libglade catalog must also expose
any internal children that can be handled, the constructor
will have already run and allowed you to achieve this,
this is the recursiveness that is a little weird/untested....
again I dont see why it would break.


Cheers,
                   -Tristan






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