diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-02-28 15:18:33 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-02-28 15:18:33 +0000 |
commit | 9c218d546ab5b5876fecb4e402a9ddfa8bf26cae (patch) | |
tree | 336aa0232b766c14550625ce11d5c6591ffe6dbc /rpmdrake.pm | |
parent | 687df4d2faf70ecaf5ef3bd1f05e9607ed6ee1c6 (diff) | |
download | rpmdrake-9c218d546ab5b5876fecb4e402a9ddfa8bf26cae.tar rpmdrake-9c218d546ab5b5876fecb4e402a9ddfa8bf26cae.tar.gz rpmdrake-9c218d546ab5b5876fecb4e402a9ddfa8bf26cae.tar.bz2 rpmdrake-9c218d546ab5b5876fecb4e402a9ddfa8bf26cae.tar.xz rpmdrake-9c218d546ab5b5876fecb4e402a9ddfa8bf26cae.zip |
finish using urpmi callbacks when updating sources
Diffstat (limited to 'rpmdrake.pm')
-rw-r--r-- | rpmdrake.pm | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/rpmdrake.pm b/rpmdrake.pm index 317e7d66..25dc0fa7 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -339,37 +339,39 @@ by Mandrake Linux Official Updates.")), return ''; sub show_urpm_progress { my ($label, $pb, $mode, $file, $percent, $total, $eta, $speed) = @_; - my $progress_filename if 0; - if ($mode eq 'localcopy') { + $file =~ s|([^:]*://[^/:\@]*:)[^/:\@]*(\@.*)|$1xxxx$2|; #- if needed... + if ($mode eq 'copy') { $pb->set_fraction(0); - $label->set_label(N("Copying local file `%s'...", $file)); - } elsif ($mode eq 'start') { - ($progress_filename = $file) =~ s|([^:]*://[^/:\@]*:)[^/:\@]*(\@.*)|$1xxxx$2|; #- if needed... + $label->set_label(N("Copying file for source `%s'...", $file)); + } elsif ($mode eq 'parse') { + $pb->set_fraction(0); + $label->set_label(N("Examining file of source `%s'...", $file)); + } elsif ($mode eq 'retrieve') { $pb->set_fraction(0); - $label->set_label(N("Starting download of `%s'...", $progress_filename)); - } elsif ($mode eq 'up2date') { + $label->set_label(N("Examining distant file of source `%s'...", $file)); + } elsif ($mode eq 'start') { $pb->set_fraction(0); - $label->set_label(N("Local file `%s' already up to date", $progress_filename)); + $label->set_label(N("Starting download of `%s'...", $file)); } elsif ($mode eq 'progress') { if (defined $total && defined $eta) { $pb->set_fraction($percent/100); - $label->set_label(N("Download of `%s', time to go:%s, speed:%s", $progress_filename, $eta, $speed)); + $label->set_label(N("Download of `%s', time to go:%s, speed:%s", $file, $eta, $speed)); } else { $pb->set_fraction($percent/100); - $label->set_label(N("Download of `%s', speed:%s", $progress_filename, $percent, $speed)); + $label->set_label(N("Download of `%s', speed:%s", $file, $percent, $speed)); } - } elsif ($mode eq 'end') { - $label->set_label(N("Please wait, updating media...")); + } elsif ($mode eq 'done') { + $pb->set_fraction(1.0); + $label->set_label($label->get_label . N(" done.")); } Gtk2->update_ui; } sub update_sources { my ($urpm, %options) = @_; - my $distant = any { /^ftp|http/ } map { if_($_->{modified}, $_->{url}) } @{$urpm->{media}}; my $w = wait_msg(my $label = Gtk2::Label->new(N("Please wait, updating media...")), - if_($distant, widgets => [ my $pb = gtkset_size_request(Gtk2::ProgressBar->new, 400, 0) ])); - $urpm->update_media(%options, if_($distant, callback => sub { show_urpm_progress($label, $pb, @_) })); + widgets => [ my $pb = gtkset_size_request(Gtk2::ProgressBar->new, 400, 0) ]); + $urpm->update_media(%options, callback => sub { show_urpm_progress($label, $pb, @_) }); remove_wait_msg($w); } |