Re: Second draft (was Re: defs files)



On Thu, Jan 20, 2000 at 07:09:10PM -0500, Havoc Pennington wrote:
> You misunderstand - GTK_RUN_ACTION means you can emit the signal
> "bare" with no preparation or de-preparation. i.e., with
> gtk_signal_emit().
> 
> If a signal is not GTK_RUN_ACTION, the only way to emit it is via
> provided functions, if available. Functions are not always provided,
> and may have side effects other than emitting the signal.
> 
> For example gtk_entry_set_text() will emit the "changed" signal, and
> is one of the few ways to emit that signal, you can't just emit
> "changed" from user code. I don't think there's a function to emit it.
> gtk_widget_show() eventually results in a "mapped" signal, but it's a
> bit complex how that signal is arrived at.
> 
> On the other hand gtk_button_pressed() is just a trivial wrapper.
> And gtk_button_clicked() is superfluous since you could
> gtk_signal_emit() in that case.

I however agree with karl on this one.  I've done this for gob (it doesn't
yet correctly handle the RUN flags, well only first and last)

The thing is that having a gtk_widget_show do more then emit the show signal
is a little bit inconsistent.  I like to think of signals as just another
type of a method, in fact a virtual method with an extra twist.  So what gob
does is make a signal emitting wrapper function that JUST emits the signal.
This is done even for internally in the widget (note the recent gnome-session
stuff gtk_signal_emit problem in gnome-libs to see why wrapping it is a good
idea).  So if the code internally wants to emit a signal but doesn't want
others to emit it, the signal method is private and only a static wrapper
will be generated.  If it's public it will have a public wrapper generated.
(This sorta makes the RUN_ACTION flag a little useless as I understand it
then).  So in gob you can be sure that a function with
object_name_signal_name IS the emitting function and it's prototype is
EXACTLY the prototype of the default handler.  So if someone is to write
bindings for some gob generated code, all they have to do is wrap ALL public
methods.  They in fact don't have to worry much about it emitting a signal I
guess except for the documentation.  It's just another method to which you
can bind pre or post hooks.

George



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