/usr/share/perl5/Gscan2pdf/PageRange.pm is in gscan2pdf 2.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | package Gscan2pdf::PageRange;
use strict;
use warnings;
use Gscan2pdf::Translation '__'; # easier to extract strings with xgettext
use Gtk3;
use Glib qw(TRUE FALSE); # To get TRUE and FALSE
# Note: in a BEGIN block to ensure that the registration is complete
# by the time the use Subclass goes to look for it.
BEGIN {
Glib::Type->register_enum( 'Gscan2pdf::PageRange::Range',
qw(selected all) );
}
# this big hairy statement registers our Glib::Object-derived class
# and sets up all the signals and properties for it.
use Glib::Object::Subclass Gtk3::VBox::,
signals => { changed => {}, },
properties => [
Glib::ParamSpec->enum(
'active', # name
'active', # nickname
'Either selected or all', #blurb
'Gscan2pdf::PageRange::Range',
'selected', # default
[qw/readable writable/] #flags
),
];
our $VERSION = '2.1.0';
my @widget_list;
sub INIT_INSTANCE {
my $self = shift;
my %buttons = (
'selected' => __('Selected'),
'all' => __('All'),
);
my $vbox = Gtk3::VBox->new;
$self->add($vbox);
#the first radio button has to set the group,
#which is undef for the first button
my $group;
for my $nick ( sort keys %buttons ) {
$self->{button}{$nick} =
Gtk3::RadioButton->new_with_label_from_widget( $group,
$buttons{$nick} );
$self->{button}{$nick}->signal_connect(
'toggled' => sub {
if ( $self->{button}{$nick}->get_active ) {
$self->set_active($nick);
}
}
);
$vbox->pack_start( $self->{button}{$nick}, TRUE, TRUE, 0 );
if ( not $group ) { $group = $self->{button}{all} }
}
push @widget_list, $self;
return;
}
sub get_active {
my ($self) = @_;
return $self->get('active');
}
sub set_active {
my ( $self, $active ) = @_;
for my $widget (@widget_list) {
$widget->{active} = $active;
for my $nick ( keys %{ $self->{button} } ) {
if ( $active eq $nick ) {
$widget->{button}{$nick}->set_active(TRUE);
$widget->signal_emit('changed');
}
}
}
return;
}
1;
__END__
|