X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fdialog-common.c;h=416be46f443389adeaf6cac2ede7ceb4f74426b4;hb=4ad4b27b32995ab6d61167029b66c80411c25962;hp=c61cb14a64a88ef4b3dba174f194277c5c552216;hpb=6982cc4aef29f7026e75702174efa8091d9badb2;p=pspp diff --git a/src/ui/gui/dialog-common.c b/src/ui/gui/dialog-common.c index c61cb14a64..416be46f44 100644 --- a/src/ui/gui/dialog-common.c +++ b/src/ui/gui/dialog-common.c @@ -165,3 +165,28 @@ numeric_only (GtkWidget *source, GtkWidget *dest) return retval; } +/* + A pair of functions intended to be used as callbacks for the "toggled" signal + of a GtkToggleButton widget. They make the sensitivity of W follow the status + of the togglebutton. +*/ +void +set_sensitivity_from_toggle (GtkToggleButton *togglebutton, GtkWidget *w) +{ + gboolean active = gtk_toggle_button_get_active (togglebutton); + + gtk_widget_set_sensitive (w, active); +} + +/* */ +void +set_sensitivity_from_toggle_invert (GtkToggleButton *togglebutton, + GtkWidget *w) +{ + gboolean active = gtk_toggle_button_get_active (togglebutton); + + gtk_widget_set_sensitive (w, !active); +} + + +