Re: connect_notify weirdness, once again...



On Tue, 2005-04-05 at 21:50 +0000, Matthias Kaeppler wrote:
> Hello,
> 
> I'm once again having trouble using connect notify. I'm still uncertain why I
> need this function at all, the documentation is lacking at this point.
> 
> What I want to do is showing a context menu when the client right-clicks my
> treeview. Okay, here come the questions:
> 
> 1. The documentation says I either have to inherit from TreeView and overwrite
> on_button_press_event() or use connect_notify to bind an own function from which
> I call the base class handler. What's the reasoning here? Why can't I just
> directly override on_button_press_event()?

You can, as you said above.

But you often can not connect a signal with connect() instead of
connect_notify(), because the existing signal handler specifies (via the
return value) that other signal handlers (yours) should not be called.
This is not a great API, but luckily
1) It's only for X-Event signal handlers, and they are relatively rare.
2) It's documented.

There's a bug open about this. I haven't given up hope of making this
simpler in future:
http://bugzilla.gnome.org/show_bug.cgi?id=126213
(The TreeView is mentioned in a dependent bug.)

> 2. What is the whole point of the boolean return values

That's explained in the X Events part of the signal chapter, I think.
They say whether handlers should continue to be called for this emission
of the signal.

>  and wrapping them away
> with connect_notify?

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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