gtk_spin_button_set_adjustment without triggering value-changed signal
- From: Anthony Ruth <Anthony J Ruth 12 nd edu>
- To: gtk-app-devel-list gnome org
- Subject: gtk_spin_button_set_adjustment without triggering value-changed signal
- Date: Mon, 6 Feb 2017 15:14:02 -0500
Hello,
I have a bunch of spin buttons with the "value-changed" signal connected:
g_signal_connect_swapped(spinbutton, "value-changed", G_CALLBACK
(run),NULL);
When I load a file, I want to set sane values for the spin buttons and I do
this by calling gtk_spin_button_set_adjustment.
gboolean load()
{
//Do stuff with file chooser
gtk_spin_button_set_adjustment(spinbutton1,gtk_adjustment_new (0,
0, T_max, 1, 10, 0.0));
gtk_spin_button_set_adjustment(spinbutton2,gtk_adjustment_new (T_max, 0,
T_max, 1, 10, 0.0));
run();
return TRUE;
}
The problem is that when gtk_spin_button_set_adjustment is called it
immediately triggers the signal. So for instance after I call set
adjustment on spinbutton1 it goes and triggers the "run" function, even
before setting the adjustment on spinbutton2. This triggers the function
"run" with insane values. I tried using change-value instead of
value-changed, but then the signal does not trigger even when I manually
adjust the spinbutton. How can I prevent gtk_spin_button_set_adjustment
from triggering the value-changed event? I only want the event to trigger
if the user changes the value of the spin button?
thanks,
-Anthony
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]