Skip to content

Instantly share code, notes, and snippets.

@Timbus
Created July 13, 2013 06:35
Show Gist options
  • Save Timbus/5989671 to your computer and use it in GitHub Desktop.
Save Timbus/5989671 to your computer and use it in GitHub Desktop.
Currently working
class My::Model {
use GTKBind::Model;
attach 'text' => (
to => [ 'entry', 'label' ],
default => 'derp',
);
attach 'reset_active' => (
to => { id => 'resetbutton', property => 'sensitive' },
default => 0,
depends => 'text',
calculate => sub {
my $self = shift;
my $val = shift; #In this case, it's always 'text'.
return $self->$val ne $self->default($val);
}
);
}
class My::Controller {
use GTKBind::Controller;
on 'resetbutton', 'clicked' => sub {
my $self = shift;
$self->model->reset('text');
};
watch 'reset_active' => sub {
say "reset_active changed";
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment