Fwd: Re: accessor functions in gtk3



This apparently should have been sent to the list.


-------- Forwarded Message --------
Subject: Re: accessor functions in gtk3
Date: Thu, 30 Jun 2016 22:30:10 +0200
From: Nicolas Soubeiran <nicolas soubeiran gmail com>
To: pelzflorian pelzflorian de

Hi,
If I don't know about the im context (I do not see any accessor, and I
suppose the "previous" code was an hack) I've noticed the comment :
  // The following signals replace the old "signal::changed", since that
  // does not allow for the selection to be changed in it's callback.

It is not true :  you can change the value of an entry in the "changed"
signal, yet you have to block the connected signal (see
https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-handler-block
and others functions) to prevent recursive call.
the code should look like :
void my_entry_cbk (GtkEntry* entry , void* user_data)
{
g_signal_handlers_block_by_func (entry, my_entry_cbk, user_data);
...
gtk_entry_set_text (entry, new_text);
...
g_signal_handlers_unblock_by_func (entry, my_entry_cbk, user_data);
}
​or you ​can get the handler id when connecting the signal.


It should be easier to maintain than the current list of signal

Regards



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