/[soft]/rpm/urpmi/trunk/gurpm/RPMProgressDialog.pm
ViewVC logotype

Diff of /rpm/urpmi/trunk/gurpm/RPMProgressDialog.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8116 by tv, Thu May 2 06:56:12 2013 UTC revision 8117 by tv, Thu May 2 14:41:48 2013 UTC
# Line 51  sub title { Line 51  sub title {
51  my ($mainw, $urpm, $old_main_window);  my ($mainw, $urpm, $old_main_window);
52    
53  my $progressbar_size = 450;  my $progressbar_size = 450;
54  my ($progress_nb, $download_nb, $uninst_count);  my ($progress_nb, $download_nb, $index);
55    
56    
57  =head2 Creators  =head2 Creators
# Line 164  sub init_progressbar { Line 164  sub init_progressbar {
164      $progressbar->set_size_request($progressbar_size, -1);      $progressbar->set_size_request($progressbar_size, -1);
165      $vbox->pack_start($progressbar, 0, 0, 0);      $vbox->pack_start($progressbar, 0, 0, 0);
166      $w->{progressbar} = $progressbar;      $w->{progressbar} = $progressbar;
167      $progress_nb = $download_nb = $uninst_count = 0;      $progress_nb = $download_nb = $index = 0;
168    
169      $w->change_widget($vbox);      $w->change_widget($vbox);
170  }  }
# Line 188  Update the progress bar Line 188  Update the progress bar
188    
189  sub set_progressbar {  sub set_progressbar {
190      my ($w, $local_ratio) = @_;      my ($w, $local_ratio) = @_;
191      if ($progress_nb || $download_nb || $uninst_count) { # this happens when computing transaction      if ($progress_nb || $download_nb) { # this happens when computing transaction
192          $w->{global_progressbar}->set_fraction(($download_nb + $progress_nb + $uninst_count - 1 + $local_ratio) / 2 / $urpm->{nb_install});          $w->{global_progressbar}->set_fraction(($download_nb + $progress_nb - 1 + $local_ratio) / 2 / $urpm->{nb_install});
193      }      }
194      $w->{progressbar}->set_fraction($local_ratio);      $w->{progressbar}->set_fraction($local_ratio);
195  }  }
# Line 305  sub callback_inst { Line 305  sub callback_inst {
305      my $pkg = defined $id ? $urpm->{depslist}[$id] : undef;      my $pkg = defined $id ? $urpm->{depslist}[$id] : undef;
306      if ($subtype eq 'start') {      if ($subtype eq 'start') {
307          if ($type eq 'trans') {          if ($type eq 'trans') {
308              $uninst_count = 0;              $index = 0;
309              $mainw->set_progresslabel(N("Preparing..."));              $mainw->set_progresslabel(N("Preparing..."));
310          } else {          } else {
311              my $msg;              my $msg;
312              if ($type eq 'uninst') {              if ($type eq 'uninst') {
313                  $msg = N("Removing package `%s' ...", $urpm->{trans}->Element_fullname($progress_nb+$uninst_count));                  $msg = N("Removing package `%s' ...", $urpm->{trans}->Element_fullname($index));
                 $uninst_count++;  
314              } else {              } else {
315                  $progress_nb++;                  $progress_nb++;
316                  $msg = N("Installing package `%s' (%s/%s)...", $pkg->name, $progress_nb, $urpm->{nb_install});                  $msg = N("Installing package `%s' (%s/%s)...", $pkg->name, $progress_nb, $urpm->{nb_install});
317              }              }
318                $index++;
319              $download_nb = max($download_nb, $progress_nb);              $download_nb = max($download_nb, $progress_nb);
320              $mainw->set_progressbar(0);              $mainw->set_progressbar(0);
321              $mainw->set_progresslabel($msg);              $mainw->set_progresslabel($msg);

Legend:
Removed from v.8116  
changed lines
  Added in v.8117

  ViewVC Help
Powered by ViewVC 1.1.30