Re: GTK Signal handlers return TRUE or FALSE?



On Mon, Jun 29, 1998 at 09:41:10PM -0400, Owen Taylor wrote:
> 
> First, note that the return from a signal emission is the 
> return of the _last_ handler executed. Since event signals
> are all of type GTK_RUN_LAST, this will be the default handler,
> unless you connect with gtk_signal_connect_after().

Ok, this is starting to make sense, but what about GTK_RUN_FIRST
signals?  Will I have to do some fancy juggling of the signal_vector?

I'm playing with the gtk clist "select_row" signal which is defined
GTK_RUN_FIRST.

I tried connecting two handlers, one _after and one not _after (?)

	gtk_signal_connect(GTK_OBJECT(clist), "select_row",
                           GTK_SIGNAL_FUNC(select_row), NULL);
	gtk_signal_connect_after(GTK_OBJECT(clist), "select_row",
                           GTK_SIGNAL_FUNC(select_row2), NULL);

my select_row() callbacks looked like this with different gprints()

        g_print("After: Selection should have been blocked!!!\n");
        gtk_signal_emit_stop_by_name(GTK_OBJECT(clist), "select_row");
        return TRUE;

Installing both handlers, I was able to block the select_row2() handler
(the one installed _after) using gtk_signal_emit_stop_by_name (or possibly
the return TRUE) in the first handler, but I couldn't override the default.
If I hack gtkclist to make it's handlers RUN_LAST, I can override them
just fine, but is there a better solution?

Now I've come up with another simple question.  Is it possible to
have signals which aren't connected to an object or do I gotta create
a new class if I want a "queue_my_special_function" signal?  Or do I
cheat, have an wigdget that isn't drawn anywere and use its "clicked"
handler to mean run_my_special_function and hope it doesn't bitch about
not having a parent?


Thanks for the help so far Owen.

----------------------------------------------------------------
 I love Saturday morning cartoons, what classic humour!  This 
 is what entertainment is all about ... Idiots, explosives
 and falling anvils.     -- Calvin and Hobbes, Bill Watterson
----------------------------------------------------------------



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