Re: [pygtk] connect_after does not work for treeview
- From: James Henstridge <james daa com au>
- To: Christian Reis <kiko async com br>
- Cc: gtk-app-devel-list gnome org, Stephen Kennedy <Stephen Kennedy havok com>, pygtk daa com au
- Subject: Re: [pygtk] connect_after does not work for treeview
- Date: Thu, 27 Mar 2003 09:11:44 +0800
Christian Reis wrote:
Can the class handler be run multiple times, then, if both _LAST and
_FIRST are set, for instance?
Yes, but they seldom do (I am not sure if any of the signals in GTK do so).
What are signals with return types?
Integer, boolean, etc. The type of the value returned by the signal.
The signal framework imposes the restriction that signals with a return
value can't be RUN_FIRST only (so that connect and connect_after do
different things).
How does it work for signal emissions, and how does it differ from event
signals? I should write up a FAQ on this, the tutorial doesn't make it
nearly clear enough.
It is done with an accumulator (which most people never need to even
think about ...). An accumulator function is used to accumulate the
return values of all the handlers attached to the signal to give the
final return value of the signal emission. The one for GtkWidget's
event signals looks like this:
gboolean
_gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy)
{
gboolean continue_emission;
gboolean signal_handled;
signal_handled = g_value_get_boolean (handler_return);
g_value_set_boolean (return_accu, signal_handled);
continue_emission = !signal_handled;
return continue_emission;
}
It sets the signal return value to the value returned by the last
handler. It then decides whether to continue the emission if the return
value is False.
Most uses of stop_emit_by_name() can be converted to simply do "return
True" now. You hardly ever need to manually stop the emission for event
signals in GTK 2.x.
Why did we have to do it back in GTK 1.2?
Because 1.2 didn't use the above accumulator.
James.
--
Email: james daa com au
WWW: http://www.daa.com.au/~james/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]