From 751c3517d6f58718cf03ebca64041a7776413f8e Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 16 Mar 2013 09:03:33 +0000 Subject: show removed packages in progress too --- gurpm/RPMProgressDialog.pm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'gurpm') diff --git a/gurpm/RPMProgressDialog.pm b/gurpm/RPMProgressDialog.pm index 4e51b644..7dd04038 100644 --- a/gurpm/RPMProgressDialog.pm +++ b/gurpm/RPMProgressDialog.pm @@ -26,7 +26,7 @@ How to use: trans_log => &gurpm::RPMProgressDialog::callback_download, inst => \&gurpm::RPMProgressDialog::callback_inst, trans => \&gurpm::RPMProgressDialog::callback_inst, - callback_report_uninst => ... + uninst => \&gurpm::RPMProgressDialog::callback_inst, .... =head1 DESCRIPTION @@ -34,6 +34,7 @@ How to use: =cut use strict; +use feature 'state'; use Gtk2; use urpm::download; use urpm::msg 'N'; @@ -229,16 +230,23 @@ Its purpose is to display installation progress in the dialog. sub callback_inst { my ($urpm, $type, $id, $subtype, $amount, $total) = @_; my $pkg = defined $id ? $urpm->{depslist}[$id] : undef; + state $uninst_count; if ($subtype eq 'start') { if ($type eq 'trans') { + $uninst_count = 0; $mainw->set_progresslabel(N("Preparing...")); - } elsif ($pkg) { - $progress_nb++; + } else { + my $msg; + if ($type eq 'uninst') { + $msg = N("Removing package `%s' ...", $urpm->{trans}->Element_fullname($uninst_count)); + $uninst_count++; + } else { + $progress_nb++; + $msg = N("Installing package `%s' (%s/%s)...", $pkg->name, $progress_nb, $urpm->{nb_install}); + } $download_nb = max($download_nb, $progress_nb); $mainw->set_progressbar(0); - $mainw->set_progresslabel( - N("Installing package `%s' (%s/%s)...", $pkg->name, $progress_nb, $urpm->{nb_install}) - ); + $mainw->set_progresslabel($msg); } } elsif ($subtype eq 'progress') { $mainw->set_progressbar($amount / $total); @@ -246,10 +254,6 @@ sub callback_inst { $mainw->sync; } -sub callback_remove { - $mainw->set_progresslabel(N("removing %s", $_[0])); -} - =item callback_download($mode, $file, $percent, $total, $eta, $speed) This callback is called when packages are downloaded prior being installed -- cgit v1.2.1