home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / Debconf / Element / Gnome / Progress.pm < prev    next >
Encoding:
Perl POD Document  |  2009-03-24  |  1.1 KB  |  64 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::Element::Gnome::Progress;
  6. use strict;
  7. use Gtk2;
  8. use utf8;
  9. use Debconf::Encoding qw(to_Unicode);
  10. use base qw(Debconf::Element::Gnome);
  11.  
  12.  
  13. sub _fraction {
  14.     my $this=shift;
  15.  
  16.     return (($this->progress_cur() - $this->progress_min()) / ($this->progress_max() - $this->progress_min()));
  17. }
  18.  
  19. sub start {
  20.     my $this=shift;
  21.     my $description=to_Unicode($this->question->description);
  22.     my $frontend=$this->frontend;
  23.  
  24.     $this->SUPER::init(@_);
  25.     $this->multiline(1);
  26.     $this->expand(1);
  27.  
  28.     $frontend->title($description);
  29.  
  30.     $this->widget(Gtk2::ProgressBar->new());
  31.     $this->widget->show;
  32.     $this->widget->set_text(' ');
  33.     $this->addwidget($this->widget);
  34.     $this->addhelp;
  35. }
  36.  
  37. sub set {
  38.     my $this=shift;
  39.     my $value=shift;
  40.  
  41.     $this->progress_cur($value);
  42.     $this->widget->set_fraction($this->_fraction);
  43.  
  44.     return 1;
  45. }
  46.  
  47. sub info {
  48.     my $this=shift;
  49.     my $question=shift;
  50.  
  51.     $this->widget->set_text(to_Unicode($question->description));
  52.     
  53.     return 1;
  54. }
  55.  
  56. sub stop {
  57.     my $this=shift;
  58.     my $frontend=$this->frontend;
  59.  
  60.     $frontend->title($frontend->requested_title);
  61. }
  62.  
  63. 1;
  64.