~ubuntu-branches/ubuntu/wily/padre/wily

« back to all changes in this revision

Viewing changes to lib/Padre/Action.pm

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2009-08-12 14:44:55 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090812144455-yvk90oa92khfcnls
Tags: 0.42-1
* New Upstream Version
  + add explicit dependency on libtest-simple-perl (>= 0.88)
  + rules: use dh --with quilt (and bump quilt build-dependency to 0.46-7)
  + rules: no need to re-generate .mo files from .po. Upstream does it now
  + copyright: describe share/icons/padre/16x16/logo.png
    - describe share/icons/padre/16x16/toggle-comments.png
    - Padre license is the same as Perl (i.e. not Perl 5)
    - update list of copright holders
    - also list translators
  + drop libtest-most-perl from build-dependencies
  + add liblocale-msgfmt-perl to build-dependencies
  + add libcapture-tiny-perl to (build-)dependencies
  + add libfile-remove-perl (>= 1.42) to (build-)dependencies
  + drop libmodule-inspector-perl from (build-)dependencies
  + add libppix-editortools-perl to (build-)dependencies
  + add libparse-exuberantctags-perl to (build-)dependencies
  + patches:
    - drop lower-wx-requirement-to-2.8.7.patch and replace it with
      SKIP_WXWIDGETS_VERSION_CHECK=1 when configuring
      adjust README.debian accordingly
    - refresh disable-tcp-server.patch
    - drop don't-require-new-file-path.patch (applied upstream)
    - rework fix-pod2-errors.patch (new release, new errors :))
* add fix-perl-interpreter-path.patch fixing the path to the perl interpreter
  in three examples (thanks lintian)
* add more lintian overrides about script-not-executable for scripts that are
  treated as examples/templates
* add fix-whatis.patch fixing the whatis entry of Padre::Wx
* add menu and .desktop file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package Padre::Action;
 
2
 
 
3
=pod
 
4
 
 
5
=head1 NAME
 
6
 
 
7
Padre::Action - Padre Action Object
 
8
 
 
9
=head1 SYNOPSIS
 
10
 
 
11
        my $action = Padre::Action->new( 
 
12
                name => 'file.save', 
 
13
                label => 'Save', 
 
14
                icon => '...', 
 
15
                shortcut => 'CTRL-S', 
 
16
                menu_event => sub { } );
 
17
 
 
18
=head1 DESCRIPTION
 
19
 
 
20
This is the base class for the Padre Action API.
 
21
 
 
22
To be documented...
 
23
 
 
24
-- Ahmad M. Zawawi
 
25
 
 
26
=head1 METHODS
 
27
 
 
28
=cut
 
29
 
 
30
use 5.008;
 
31
use strict;
 
32
use warnings;
 
33
 
 
34
our $VERSION = '0.42';
 
35
 
 
36
# Generate faster accessors
 
37
use Class::XSAccessor accessors => {
 
38
        name          => 'name',
 
39
        id            => 'id',
 
40
        label         => 'label',
 
41
        icon          => 'icon',
 
42
        shortcut      => 'shortcut',
 
43
        menu_event    => 'menu_event',
 
44
        toolbar_event => 'toolbar_event',
 
45
};
 
46
 
 
47
#####################################################################
 
48
# Constructor
 
49
 
 
50
=pod
 
51
 
 
52
=head2 new
 
53
 
 
54
A default contructor for action objects.
 
55
 
 
56
=cut
 
57
 
 
58
sub new {
 
59
        my ( $class, %opts ) = @_;
 
60
 
 
61
        #XXX - validate options
 
62
 
 
63
        my $self = bless {}, $class;
 
64
 
 
65
        $self->name( $opts{name} );
 
66
        $self->id( $opts{id} || -1 );
 
67
        $self->label( $opts{label} );
 
68
        $self->icon( $opts{icon} );
 
69
        $self->shortcut( $opts{shortcut} );
 
70
        $self->menu_event( $opts{menu_event} );
 
71
        $self->toolbar_event( $opts{toolbar_event} );
 
72
 
 
73
        return $self;
 
74
}
 
75
 
 
76
#
 
77
# A label textual data without any strange menu characters
 
78
#
 
79
sub label_text {
 
80
        my $self  = shift;
 
81
        my $label = $self->label;
 
82
        $label =~ s/\&//g;
 
83
        return $label;
 
84
}
 
85
 
 
86
#####################################################################
 
87
# Main Methods
 
88
 
 
89
=pod
 
90
 
 
91
=head1 COPYRIGHT & LICENSE
 
92
 
 
93
Copyright 2008-2009 The Padre development team as listed in Padre.pm.
 
94
 
 
95
This program is free software; you can redistribute
 
96
it and/or modify it under the same terms as Perl itself.
 
97
 
 
98
The full text of the license can be found in the
 
99
LICENSE file included with this module.
 
100
 
 
101
=cut
 
102
 
 
103
1;
 
104
 
 
105
# Copyright 2008-2009 The Padre development team as listed in Padre.pm.
 
106
# LICENSE
 
107
# This program is free software; you can redistribute it and/or
 
108
# modify it under the same terms as Perl 5 itself.