« blib/lib/Gapp/Moose/Meta/Attribute/Trait/GappExpander.pm
↑ Summary
blib/lib/Gapp/Moose/Meta/Attribute/Trait/GappFileChooserDialog.pm »
| 1 | package Gapp::Moose::Meta::Attribute::Trait::GappFileChooserButton; | ||
| 2 | { | ||
| 3 | $Gapp::Moose::Meta::Attribute::Trait::GappFileChooserButton::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | use Moose::Role; | ||
| 6 | |||
| 7 | before '_process_options' => sub { | ||
| 8 | my ( $class, $name, $opts ) = @_; | ||
| 9 | $opts->{gclass} = 'Gapp::FileChooserButton' if ! exists $opts->{class}; | ||
| 10 | }; | ||
| 11 | |||
| 12 | has 'action' => ( | ||
| 13 | is => 'rw', | ||
| 14 | isa => 'Str', | ||
| 15 | default => 'open', | ||
| 16 | ); | ||
| 17 | |||
| 18 | has 'filters' => ( | ||
| 19 | isa => 'ArrayRef', | ||
| 20 | default => sub { [] }, | ||
| 21 | traits => [qw( Array )], | ||
| 22 | handles => { | ||
| 23 | add_filter => 'push', | ||
| 24 | filters => 'elements', | ||
| 25 | } | ||
| 26 | ); | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | before '_build_gobject' => sub { | ||
| 31 | my $self = shift; | ||
| 32 | $self->set_args( [ $self->properties->{title} ? $self->properties->{title} : '' , | ||
| 33 | $self->parent ? $self->parent->gobject : undef, | ||
| 34 | $self->action ] ); | ||
| 35 | }; | ||
| 36 | |||
| 37 | |||
| 38 | package Moose::Meta::Attribute::Custom::Trait::GappFileChooserButton; | ||
| 39 | { | ||
| 40 | $Moose::Meta::Attribute::Custom::Trait::GappFileChooserButton::VERSION = '0.60'; | ||
| 41 | } | ||
| 42 | sub register_implementation { 'Gapp::Moose::Meta::Attribute::Trait::GappFileChooserButton' }; | ||
| 43 | 1; |