Gist
handler_block is useful in each case, but I would rather call at the beginning of the program to suppress the signal for all calls to gtk_entry_set_text and gtk_toggle_button_set_active. Is there any way?
Background Information :
My program is used to create entities through the symbol creator dialog with the following attributes:
Name - selected from a predefined list via GTKComboBoxes
Animation - also GTKComboBox
Group - one of six switches that classify an object
Objects can be added - one starts with an empty add dialog, fills in all the fields and sends.
Objects can be edited in the "Edit" dialog box, where all the fields listed above are initially filled with the current attributes of the object. Editing takes place instantly (without the "Submit" button in the "Edit" dialog box), and the displayed "Entity" will be different as soon as a new value is selected from combos or switches.
I have a callback connected to a type record and triggered by a โmodifiedโ signal. The callback seems to fire whenever I set the input text manually in code to show the editable object:
gtk_entry_set_text(GTK_ENTRY(name_entry), entity.name);
Yes, there is a way with g_signal_handler_block , but this requires
1) get the gulong , which is created when the signal is first connected. g_signal_connect(args); against gulong entry_handler_id = g_signal_connect(args);
2) Use block / unlock idioms for each individual call.
g_signal_handler_block(args, entry_handler_id);
gtk_entry_set_text(args);
g_signal_handler_unblock(args, entry_handler_id);
or, worse,
g_signal_handler_block(args, entry_handler_id);
fn_that_calls_gtk_entry_set_text();
g_signal_handler_unblock(args, entry_handler_id);
source share