Re: Signal Handler Block



"Vladimir V. Markevich" wrote:

[...]
To my regret, I can't find where is GladePerl saved connection id, if they
did it, or connect signal by hand. What is the GladeXML modules ?
No, Glade-Perl does not save the connection id anywhere although the
signal name and the callback name can be known. It would not be difficult 
to save the connection id and I would suggest that Glade-Perl could
generate code that looked something like:
  $forms->{'Formname'}{'__CONNECT_ID'}{'open1'}{'activate'} =
    $forms->{'Formname'}{'open1'}->signal_connect( 'activate', 
        "$class\::on_open1_activate", '', 'open1', "Formname-$instance" );

which is essentially:
  $id = $widget->signal_connect('signal', 'handler', @data);

so that you can always use the connection id ($id) later.

I reckon that it is important to save the id with the form so that you can
have several instances of the form visible and block the signal connection
for any one of them. It is also important to use a key (eg '__CONNECT_ID')
that will not used as a widget name. However, I will consider any other
suggestions if there is a better way.

I think it would be a useful API addition, we would just need to agree
on how it would look to the programmer.

Do you mean functions: signal_handler_block_by_func, 
signal_handler_block_by_data,
it's would be very useful for me.
I am not sure what you are trying to achieve but have you considered using
$widget->signal_emit_stop_by_name('name')

Let me know if I you would like Glade-Perl to generate this code.

Regards, Dermot





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