X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fdialog-common.c;h=9e97923e3f977188d305e791d3f3ad9c1ad887cc;hb=6dc7fb98e663313902b4d3977407c63e83d8ae19;hp=c61cb14a64a88ef4b3dba174f194277c5c552216;hpb=f550aee00a62fe1d8baf62d83cd7efef6cc2ee92;p=pspp diff --git a/src/ui/gui/dialog-common.c b/src/ui/gui/dialog-common.c index c61cb14a64..9e97923e3f 100644 --- a/src/ui/gui/dialog-common.c +++ b/src/ui/gui/dialog-common.c @@ -165,3 +165,30 @@ 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); + if (active) + gtk_widget_grab_focus (w); +} + +/* */ +void +set_sensitivity_from_toggle_invert (GtkToggleButton *togglebutton, + GtkWidget *w) +{ + gboolean active = gtk_toggle_button_get_active (togglebutton); + + gtk_widget_set_sensitive (w, !active); +} + + +