I listen to "changed" signal of a GtkComboBox. I empty and refill GtkComboBoxText which is a simple variant of GtkComboBox. I'm trying to use a macro g_signal_handlers_block_by_func(instance, func, data) so that the "changed" signal won't be emitted to my callback function while emptying and refilling that box.
I get an error when passing a function as a func: error: ISO C forbids passing argument 6 of ‘g_signal_handlers_block_matched’ between function pointer and ‘void *’ [-Werror=pedantic]
It happens because func is casted to gpointer (typedef to (void*)) in g_signal_handlers_block_matched. As I have understood casting function pointer to data pointer is illegal.
Example:
static void my_callback(GtkComboBox *box, GtkComboBox *other_box)
{
// Some code here
}
g_signal_connect(combo_box, "changed", G_CALLBACK(my_callback), other_box);
// To temporary block changed signals for reaching other_box:
g_signal_handlers_block_by_func(combo_box, G_CALLBACK(my_callback), other_box);
Also tried without G_CALLBACK but it doesn't make a difference. The issue is the same.
How should I use g_signal_handlers_block_by_func?