Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-03 Thread infirit
Op 11/03/2016 om 10:47 AM schreef pozzugno: > Another situation, similar to mine. You have a dialog window with a > SpinButton showing the volume speaker. When the dialog is shown, the > SpinButton value should be the current volume level. The user could > change the volume speaker by changing the

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-03 Thread pozzugno
Il 03/11/2016 01:20, infirit ha scritto: Op 11/03/2016 om 12:19 AM schreef pozzugno: Il 02/11/2016 18:55, Nicola Fontana ha scritto: Il Wed, 2 Nov 2016 14:40:58 +0100 Pozz Pozz scrisse: 2016-11-02 11:24 GMT+01:00 Nicola Fontana : ... you don't necessarily need the handler id. In C (I don't

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-03 Thread pozzugno
Il 03/11/2016 00:48, Michael Torrie ha scritto: On 11/02/2016 05:19 PM, pozzugno wrote: It seems pyGObject implementation gives only two "handler block" functions: handler_block(), that needs the handler_id that I don't have; handler_block_by_func() that needs the callback to block (the same pro

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-02 Thread infirit
Op 11/03/2016 om 12:19 AM schreef pozzugno: > Il 02/11/2016 18:55, Nicola Fontana ha scritto: >> Il Wed, 2 Nov 2016 14:40:58 +0100 Pozz Pozz >> scrisse: >> >>> 2016-11-02 11:24 GMT+01:00 Nicola Fontana : ... you don't necessarily need the handler id. In C (I don't use python) y

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-02 Thread Michael Torrie
On 11/02/2016 05:19 PM, pozzugno wrote: > It seems pyGObject implementation gives only two "handler block" > functions: handler_block(), that needs the handler_id that I don't have; > handler_block_by_func() that needs the callback to block (the same > problem of your solution, because I have di

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-02 Thread pozzugno
Il 02/11/2016 18:55, Nicola Fontana ha scritto: Il Wed, 2 Nov 2016 14:40:58 +0100 Pozz Pozz scrisse: 2016-11-02 11:24 GMT+01:00 Nicola Fontana : ... you don't necessarily need the handler id. In C (I don't use python) you could write the following: void my_set_value(GtkSpinButton *spin_butt

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-02 Thread Nicola Fontana
Il Wed, 2 Nov 2016 14:40:58 +0100 Pozz Pozz scrisse: > 2016-11-02 11:24 GMT+01:00 Nicola Fontana : > > ... > > > > you don't necessarily need the handler id. In C (I don't use > > python) you could write the following: > > > > void my_set_value(GtkSpinButton *spin_button, gdouble value) > > { > >

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-02 Thread Nicola Fontana
Il Wed, 2 Nov 2016 10:23:44 +0100 Pozz Pozz scrisse: > ... > How do you implement the generic function _my_set_value()? It should have > two parameters: spinbutton and value. signal_handler_block() function needs > the handler_id associated that I don't have. > Maybe during initialization, when I

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-01 Thread Nicola Fontana
Il Wed, 2 Nov 2016 00:09:29 +0100 pozzugno scrisse: > ... > A simple and clear sequence of instructions: > >_set_value() >_set_value() >.. > > will be transformed in a complex, long and cryptic sequence of > instructions: > >_block() >_set_value() >_unblock() >_blo

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-01 Thread pozzugno
I already thought of blocking handlers during refresh, but it means adding two instructions (_block and _unblock) for each set_value(). A simple and clear sequence of instructions: _set_value() _set_value() .. will be transformed in a complex, long and cryptic sequence of instructions:

Re: SpinButton: how to avoid calling signal handler when set_value()

2016-11-01 Thread Chris Moller
Have you tried g_signal_handler_block (gpointer instance, gulong handler_id); and g_signal_handler_unblock (gpointer instance, gulong handler_id); Putting these before and after your set_value() should temporarily block the handler. You get the handler_id from g_signal_connect(...): handle

SpinButton: how to avoid calling signal handler when set_value()

2016-11-01 Thread pozzugno
I have a SpinButton with an associated Adjustment. I connected a handler for "value-changed" signal, because I have to make something when the user changes the value. I sometimes need to change the value in the code, using set_value() method of SpinButton or Adjustment. In this case, I don't wa