how to block user-defined signal handler within signal handler properly



I have the following situation:

1. GtkAdjustment "value_changed" signal handler is invoked
(adjustment_value_changed_cb())
2. The signal handler calls an private API of mine with the supplied
value.
3. The API function determines it needs to adjust the value and notifies
the signal handler of this on return
4. The signal handler then does the following to attempt to just update
the value in the adjustment object:

gtk_signal_handler_block_by_func (GTK_OBJECT(adjustment),
                                  adjustment_value_changed_cb,
                                  user_data);

gtk_adjustment_set_value (adjustment, new_value);

gtk_signal_handler_unblock_by_func (GTK_OBJECT (adjustment),
                                    adjustment_value_changed_cb,
                                    user_data);

Unfortunetly this does not do what I expected. I expected that by
temporarily blocking the user defined signal handler and changing the
value while it was blocked, that the value would be changed by the
default handler without the adjustment_value_changed_cb() getting
invoked a second time.

How do I achieve what I want (change the adjustment/widget value in the
cb without the cb getting invoked a second time)?

-- 
regards,

Luciano Chavez

lnx1138 us ibm com          
http://sf.net/projects/evms




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