Re: [Glade-users] adding custom widgets written with Gtkmm



On Sat, 2008-09-20 at 21:14 -0400, Tristan Van Berkom wrote:
> On Sat, Sep 20, 2008 at 8:37 PM, Tristan Wibberley
> <tristan wibberley org> wrote:
> > On Sat, 2008-09-20 at 20:16 -0400, Tristan Van Berkom wrote:
> >> sure, looks like its worth a try, I wonder if its harmfull at all to
> >> call gtk_init()
> >> twice...
> >
> > hmm. I think I've been barking up the wrong tree, my "init
> > function" (ie, my constructor) is not being called and nor is my
> > on_realize function.
> >
> > Does glade-3 create an instance by using the
> > gtkmm___custom_object_mywidget_new() function? Because that is not being
> > called in my case and if it /were/ called then everything would work, I
> > think.
> 
> In the xml catalog file that you supply to glade, you are allowed
> to specify a "init-function" argument (the gnome catalog does that
> to register its icons at startup, also the python support plugin to
> initialize the interpretor).

I've used that and successfully called the Gtkmm initialization routine.


> Double check the api docs at http://glade.gnome.org/docs, do
> you want your type to be written to the glade file as "gtkmm_MyObjectType" or
> should it be written out as "MyObjectType" (not sure how this should
> look from the GtkBuilder side of things..) ?

I have no idea. The object is apparently going to be of gtype
"gtkmm__CustomObject_mywidget" so the snakecase name will be
"gtkmm___custom_object_mywidget".

glade is calling my init-function and my tests show that double init
does not break in a simple case.

glade is calling gtkmm___custom_object_mywidget_get_type

glade is not calling gtkmm___custom_object_mywidget_new but instead it
seems to be making the object in some other way that doesn't call the
object's constructor so doesn't set the NO_WINDOW flag or any other
necessary part.

I've looked into this, and it looks like a gtkmm widget cannot be
created with gtk_type_new, so I'm going to try writing a real gtk widget
adhering to the requirements of a gtk widget including support for
gtk_type_new, then make that widget have-a gtkmm custom widget which it
will forward all signals to. Hopefully that will work. I'm not sure how
to indicate that all signals should be forwarded but I'm hoping it can
be done.

-- 
Tristan



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