home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / perl5 / Debconf / Element / Gnome / Select.pm < prev    next >
Encoding:
Perl POD Document  |  2006-07-24  |  1.0 KB  |  53 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::Element::Gnome::Select;
  6. use strict;
  7. use Gtk2;
  8. use Gnome2;
  9. use utf8;
  10. use Debconf::Encoding qw(to_Unicode);
  11. use base qw(Debconf::Element::Gnome Debconf::Element::Select);
  12.  
  13.  
  14. sub init {
  15.     my $this=shift;
  16.  
  17.     my $default=$this->translate_default;
  18.     my @choices= map { to_Unicode($_) } $this->question->choices_split;
  19.  
  20.     $this->SUPER::init(@_);
  21.  
  22.     $this->widget(Gtk2::Combo->new);
  23.     $this->widget->show;
  24.  
  25.     $this->widget->set_popdown_strings(@choices);
  26.     $this->widget->set_value_in_list(1, 0);
  27.     $this->widget->entry->set_editable(0);
  28.  
  29.     if (defined($default) and length($default) != 0) {
  30.         $this->widget->entry->set_text(to_Unicode($default));
  31.     }
  32.     else {
  33.         $this->widget->entry->set_text($choices[0]);
  34.     }
  35.  
  36.     $this->adddescription;
  37.     $this->addwidget($this->widget);
  38.     $this->tip( $this->widget->entry );
  39.     $this->addhelp;
  40. }
  41.  
  42.  
  43. sub value {
  44.     my $this=shift;
  45.  
  46.     return $this->translate_to_C_uni($this->widget->entry->get_chars(0, -1));
  47. }
  48.  
  49. *visible = \&Debconf::Element::Select::visible;
  50.  
  51.  
  52. 1
  53.