Gtk2-Ex-Email-AddressVBox
view release on metacpan or search on metacpan
lib/Gtk2/Ex/Email/AddressVBox.pm view on Meta::CPAN
$hbox{new}=0;
#sets the id
$hbox{id}=rand().rand().rand();
#creates the first HB
$hbox{hbox}=Gtk2::HBox->new;
$hbox{hbox}->show;
#creates the combo box to display to, cc, and bcc
$hbox{combobox}=Gtk2::ComboBox->new_text;
$hbox{combobox}->show;
$hbox{combobox}->append_text('To: ');
$hbox{combobox}->append_text('CC: ');
$hbox{combobox}->append_text('BCC: ');
$hbox{hbox}->pack_start($hbox{combobox}, 0, 1, 0);
#sets the type
my $typeSet=undef;
if (defined($type)) {
if ($type eq 'to') {
$hbox{combobox}->set_active(0);
}
if ($type eq 'cc') {
$hbox{combobox}->set_active(1);
}
if ($type eq 'bcc') {
$hbox{combobox}->set_active(2);
}
}
if (!$typeSet) {
$hbox{combobox}->set_active(0);
}
#adds the entry box
$hbox{entry}=Gtk2::Entry->new;
$hbox{entry}->show;
$hbox{hbox}->pack_start($hbox{entry}, 1, 1, 1);
#sets the address if needed
if (defined($address)) {
$hbox{entry}->set_text($address);
lib/Gtk2/Ex/Email/AddressVBox.pm view on Meta::CPAN
my @cc;
my @bcc;
my @hboxes=keys(%{$self->{gui}{hboxes}});
#processes each one
my $int=0;
while (defined($hboxes[$int])) {
my $address=$self->{gui}{hboxes}{ $hboxes[$int] }{entry}->get_text;
my $typeInt=$self->{gui}{hboxes}{ $hboxes[$int] }{combobox}->get_active;
#figures out the type
my $type;
if ($typeInt eq '0') {
$type='to';
}
if ($typeInt eq '1') {
$type='cc';
}
if ($typeInt eq '2') {
( run in 3.016 seconds using v1.01-cache-2.11-cpan-8dfa8b56332 )