| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
Debconf::Element::Gnome::Boolean - check box widget |
| 6 |
|
| 7 |
=cut |
| 8 |
|
| 9 |
package Debconf::Element::Gnome::Boolean; |
| 10 |
use warnings; |
| 11 |
use strict; |
| 12 |
use Gtk3; |
| 13 |
use utf8; |
| 14 |
use Debconf::Encoding qw(to_Unicode); |
| 15 |
use base qw(Debconf::Element::Gnome); |
| 16 |
|
| 17 |
=head1 DESCRIPTION |
| 18 |
|
| 19 |
This is a check box widget. |
| 20 |
|
| 21 |
=cut |
| 22 |
|
| 23 |
sub init { |
| 24 |
my $this=shift; |
| 25 |
my $description=to_Unicode($this->question->description); |
| 26 |
|
| 27 |
$this->SUPER::init(@_); |
| 28 |
|
| 29 |
$this->widget(Gtk3::CheckButton->new($description)); |
| 30 |
$this->widget->show; |
| 31 |
$this->widget->set_active(($this->question->value eq 'true') ? 1 : 0); |
| 32 |
$this->addwidget($this->widget); |
| 33 |
$this->tip( $this->widget ); |
| 34 |
$this->addhelp; |
| 35 |
} |
| 36 |
|
| 37 |
=item value |
| 38 |
|
| 39 |
The value is true if the checkbox is checked, false otherwise. |
| 40 |
|
| 41 |
=cut |
| 42 |
|
| 43 |
sub value { |
| 44 |
my $this=shift; |
| 45 |
|
| 46 |
if ($this->widget->get_active) { |
| 47 |
return "true"; |
| 48 |
} |
| 49 |
else { |
| 50 |
return "false"; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
=back |
| 55 |
|
| 56 |
=head1 AUTHOR |
| 57 |
|
| 58 |
Eric Gillespie <[email protected]> |
| 59 |
Gustavo Noronha Silva <[email protected]> |
| 60 |
|
| 61 |
=cut |
| 62 |
|
| 63 |
1 |