Debian Codegraph @

Debconf/Element/Gnome/String.pm

raw
1 #!/usr/bin/perl
2
3 =head1 NAME
4
5 Debconf::Element::Gnome::String - text input widget
6
7 =cut
8
9 package Debconf::Element::Gnome::String;
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 text input widget.
20
21 =cut
22
23 sub init {
24 my $this=shift;
25
26 $this->SUPER::init(@_);
27
28 $this->widget(Gtk3::Entry->new);
29 $this->widget->show;
30
31 my $default='';
32 $default=$this->question->value if defined $this->question->value;
33
34 $this->widget->set_text(to_Unicode($default));
35
36 $this->adddescription;
37 $this->addwidget($this->widget);
38 $this->tip( $this->widget );
39 $this->addhelp;
40 }
41
42 =item value
43
44 The value is just the text field of the associated widget.
45
46 =cut
47
48 sub value {
49 my $this=shift;
50
51 # FIXME In which encoding?
52 return $this->widget->get_chars(0, -1);
53 }
54
55 =back
56
57 =head1 AUTHOR
58
59 Eric Gillespie <[email protected]>
60 Gustavo Noronha Silva <[email protected]>
61
62 =cut
63
64 1