blib/lib/Gapp/Action.pm

filter: Statementstmt 54.0% 20 / 37 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 75.0% 3 / 4 totaltotal 50.0% 27 / 54 CC 3 SCAR 11.3
CC
3
Cov
49%
create_gtk_action
6.0
perform
6.0
__ANON__
2.0
CRAP 3.1
« blib/lib/Gapp/FileChooserButton.pm ↑ Summary blib/lib/Gapp/Action/Registry.pm »
1 package Gapp::Action;
2 {
3 1 $Gapp::Action::VERSION = '0.60';
4 }
5  
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 with 'MooseX::Clone';
8 1 ▶use MooseX::SemiAffordanceAccessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use MooseX::Types::Moose qw( CodeRef HashRef Object Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 has 'code' => (
14 is => 'rw',
15 isa => 'Maybe[CodeRef]',
16 clearer => 'clear_code',
17 predicate => 'has_code',
18 );
19  
20 1 has 'icon' => (
21 is => 'rw',
22 isa => 'Maybe[Str]',
23 clearer => 'clear_icon',
24 predicate => 'has_icon',
25 );
26  
27 1 has [qw( label name mnemonic accelerator )] => (
28 is => 'rw',
29 isa => 'Maybe[Str]',
30 default => '',
31 );
32  
33 1 has 'tooltip' => (
34 is => 'rw',
35 isa => 'Maybe[Str]',
36 clearer => 'clear_tooltip',
37 predicate => 'has_tooltip',
38 );
39  
40  
41  
42 0 ▶sub create_gtk_action {
Subroutine create_gtk_action: not called CC=2 SCAR=17.9
Pod documented
43 0 my ( $self, @args ) = @_;
44 0 my %opts = (
45 name => $self->name,
46 label => $self->label,
47 tooltip => $self->tooltip,
48 icon => $self->icon,
49 args => [],
50 @args
51 );
52
53 0 ▶ if ( $opts{icon} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"icon"}) 0 0 0
54 0 $opts{'stock-id'} = $opts{icon};
55 }
56
57 0 delete $opts{icon};
58 0 my $args = delete $opts{args};
59
60 0 my $gtk_action = Gtk2::Action->new( %opts );
61 0 ▶ $gtk_action->signal_connect( activate => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 my ( $w, @gtkargs ) = @_;
63 0 $self->perform( $self, $args, $w, \@gtkargs );
64 0 });
65 0 return $gtk_action;
66 }
67  
68 0 ▶sub create_gapp_image {
Subroutine create_gapp_image: not called CC=1 SCAR=6.9
Pod documented
69 0 my ( $self, @args ) = @_;
70 0 Gapp::Image->new( gobject => Gtk2::Image->new_from_stock( $self->icon , $args[0] ) );
71 }
72  
73 0 ▶sub create_gtk_image {
Subroutine create_gtk_image: not called CC=1 SCAR=6.9
Pod documented
74 0 my ( $self, @args ) = @_;
75 0 Gtk2::Image->new_from_stock( $self->icon , $args[0] );
76 }
77  
78 0 ▶sub perform {
Subroutine perform: not called CC=2 SCAR=17.9
Pod undocumented
79 0 my ( $self, @args ) = @_;
80 0 ▶ return $self->code->( $self, @args ) if $self->has_code;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_code 0 0 0
81 }
82  
83  
84  
85 1 1;
86  
87  
88 __END__
« blib/lib/Gapp/FileChooserButton.pm ↑ Summary blib/lib/Gapp/Action/Registry.pm »