How to stop signal in the folowing case?



Hello,

Lets assume we have two spinbuttons (spinbutton_A and spinbutton_B), if I change one of the spinbuttons the callback functions:

void on_spinbutton_A_changed (GtkEditable *editable, gpointer user_data) {
   gtk_spin_button_set_value( spinbutton_B, MY_VALUE );
}

void on_spinbutton_B_changed (GtkEditable *editable, gpointer user_data) {
   gtk_spin_button_set_value( spinbutton_A, MY_VALUE );
}

are called, now as you can see, this is an never ending recursion. When I change spinbutton_A, spinbutton_B is changed too and so his callback function is called and so spinbutton_A is changed ...

Now the question is, what would be the right way to stop this behavior?

I tried already to block the signal, but this seems not to give the desired result. I had the feeling that the events were stored in the meantime, so that after I called unblock, they were processed. Is there a general way to stop a widget emitting signals as long as you manipulating it.

Thanks,
Peter!





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