Re: [glade--] glademm auto-connect feature?
- From: Murray Cumming <murrayc murrayc com>
- To: Markus <gnufriend gmx de>
- Cc: gtkmm-list gnome org, "Amadeus W.M." <amadeus84 cablespeed com>
- Subject: Re: [glade--] glademm auto-connect feature?
- Date: Wed, 22 Feb 2006 23:21:59 +0100
On Wed, 2006-02-22 at 20:29 +0100, Markus wrote:
> I don't use the code generation of glade.
We thought that you did because you used the glademm mailing list.
glademm does code generation.
I've changed this email thread to the gtkmm-list, which is relevant for
> But libglade doesn't offers a auto connect feature for C++
I have generally not bothered with this, because there's no way for you
to specify in Glade what object the signal handler should be a member
method of. However, see below.
> like it did for
It's simpler in C because there are no classes in C, so the signal
handler can only be a global function. That also makes it quite useless,
because any signal handler also needs state information about other
And, of course, if the signal handler takes different parameters than
the signal provides then you get interesting crashes.
I looked at an example that did this recently. I think the equivalent in
C++ would look something like this:
Gtk::Dialog* pDialog = 0;
refXml->autoconnect(*this); //Doesn't exist yet.
So, if you had specified on_ok_clicked() as the signal handler for the
clicked signal of an OK button, then it would look for a
Something::on_ok_clicked() method and connect it with the this instance.
That would be equivalent to doing
However, the autoconnect() method would need to know, or discover, what
C++ parameters the signal handler takes and know how to convert from the
C types to the C++ types. And back again, if there is a return type or
output parameters (rare).
I don't know how they deal with this in Gtk#, but I am generally not
impressed with the Gtk# API and I suspect that the autoconnect system is
not as reliable or useful as it is presented to be.
We also have the problem that it's probably very difficult to introspect
member methods and call them dynamically. But maybe it's possible with
the Glib::Module stuff. Anyone is free to try.
> and Java. At least i couldn't find it.
I don't know what this does, but maybe it's similar to Gtk#. It would be
worth looking at pygtk too.
murrayc murrayc com
] [Thread Prev