summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2013-03-16 09:03:33 +0000
committerThierry Vignaud <tv@mageia.org>2013-03-16 09:03:33 +0000
commit751c3517d6f58718cf03ebca64041a7776413f8e (patch)
tree1d8efc4d82bdac7160ca20b106459c4573a9ffd6
parentbedafb5a938238aa964444227b17cf1d45a36b78 (diff)
downloadurpmi-751c3517d6f58718cf03ebca64041a7776413f8e.tar
urpmi-751c3517d6f58718cf03ebca64041a7776413f8e.tar.gz
urpmi-751c3517d6f58718cf03ebca64041a7776413f8e.tar.bz2
urpmi-751c3517d6f58718cf03ebca64041a7776413f8e.tar.xz
urpmi-751c3517d6f58718cf03ebca64041a7776413f8e.zip
show removed packages in progress too
-rw-r--r--NEWS1
-rw-r--r--gurpm/RPMProgressDialog.pm24
-rwxr-xr-xgurpmi22
3 files changed, 16 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index eb02dbac..8c5ff364 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
with --update (mga#2317)
- gurpmi:
o split global progress bar widget for rpmdrake (mga#778)
+ o show removed packages in progress too
o support exceptions in callback in main wrapper too
o support other distros which do not handle exceptions in gtk+ callbacks
o use new exception management
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
diff --git a/gurpmi2 b/gurpmi2
index d652c8e8..752d9cf3 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -321,7 +321,7 @@ sub do_install_3 () {
$mainw->set_progresslabel(N("The package(s) are already installed"));
},
success_summary => sub { $mainw->set_progresslabel(N("Installation finished")) },
- callback_report_uninst => \&gurpm::RPMProgressDialog::callback_remove,
+ uninst => \&gurpm::RPMProgressDialog::callback_inst,
inst => \&gurpm::RPMProgressDialog::callback_inst,
trans => \&gurpm::RPMProgressDialog::callback_inst,
}