Re: Signal Handler Block

On Thu, 8 Nov 2001, Dermot Musgrove wrote:


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 this way will be perfect.

I am not sure what you are trying to achieve but have you considered using

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

It would be great.  For example, I want have smart date entry, 
when user type first two character of a data, it automaticly add the 
separator such as '-', and so. 
If I add signal handler on insert_text, it control user input
and after second character it must insert '-'. But in this case
insert_text handler do recursive call. That is undesirable.
If I know callback id I might block it on time inside insert_text call,
and unblock after that. 

Regards, Vladimir

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