X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fdialog-common.c;h=9e97923e3f977188d305e791d3f3ad9c1ad887cc;hb=159abf428abd3028a73d064508fac95e542d9f09;hp=c61cb14a64a88ef4b3dba174f194277c5c552216;hpb=fb4eeb650749403036535786a7d3660af0945e75;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); +} + + +