Re: Stealing a good idea from Gtk#



* Carl Nygard <cjnygard fast net> [2004-09-27 05:53]:
On Sun, 2004-09-26 at 21:45, muppet wrote:
(and, actually, impossible.  you can find out if there are
handlers connected, and you can block and disconnect, but you
can't *list* the handlers of a signal on a given instance.)

No, but couldn't you store the connection id in the array, and
use that as the means for "listing" and disconnecting.  Is it a
problem if you only keep track of the handlers you've installed
via this method?

That is almost what I was thinking, actually -- the handler ID
would only be stored internally and an internal mapping of IDs to
coderefs so it would make it appear as if it was just an array of
coderefs.

And yes, you could only track handlers installed this way (and
maybe those with Perl-side connect_signal* methods, by
overloading those).

The reason I don't like the proposition anyway is because the
syntax turns out quite clunky. You'd need to say something like

    push @{ $window->SIGNAL::delete_event }, sub {
        Gtk2->main_quit;
        return FALSE;
    };

and I always find this explicit @{} sigil+curlies business clunky
to type and read.

Regards,
-- 
Aristotle
"If you can't laugh at yourself, you don't take life seriously enough."



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