Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class OptionBoxInt : OptionBox
- {
- public OptionBoxInt (string label, string dconfSchema, string dconfOption)
- {
- base (label, dconfSchema, dconfOption);
- Gtk.SpinButton spbSpin = new Gtk.SpinButton.with_range (50, 2000, 50);
- spbSpin.value = this.getValue ();
- spbSpin.value_changed.connect (this.valueChanged);
- //this.settings.bind (dconfOption, spbSpin, "value", GLib.SettingsBindFlags.GET | GLib.SettingsBindFlags.SET);
- this.pack_start (spbSpin, false, false, 0);
- this.settings.changed[dconfOption].connect
- (
- () =>
- {
- stdout.printf ("y u no work\n");
- this.dconfValueChanged (spbSpin);
- }
- );
- }
- public int getValue ()
- {
- return this.settings.get_int (this.dconfOption);
- }
- public void setValue (int val)
- {
- this.settings.set_int (this.dconfOption, val);
- }
- private void valueChanged (Gtk.SpinButton widget)
- {
- this.setValue ((int) widget.value);
- }
- private void dconfValueChanged (Gtk.SpinButton widget)
- {
- widget.value = this.getValue ();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement