Re: stopping signals

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

 



Hi,

dave walters <walter8950@xxxxxxxxx> writes:

> I have a spin button with a callback function invoked by the
> "value_changed" signal.  The callback func has a
> gtk_spin_button_set_value(). When this executes it causes the
> spinner to emit the "value_changed' signal which invokes the
> callback which executes set_value() etc. It's recursive. I tried
> using g_signal_stop_emission_by_name() put in before the set_value()
> but it didn't work. Any ideas??

I don't understand the reason for this particular callback construct
but since in general user interface elements often need to be updated
from callback functions and the recursiveness you describe is causing
problems for GObject newbies, here's how to solve this problem:

Either block the "value_changed" signal handler using
g_signal_handlers_block_by_func() before you set the value and unblock
it later or compare the set value with the new one and only set the
value if the two differ.


Sven

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux