diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-02-22 21:10:31 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-02-22 21:10:31 +0000 |
commit | 5fc500f31f6136a536bf5f9ced146077d589e5fb (patch) | |
tree | d21dd082b06292aa1e1916f9da3717e1586f7e63 /rpmdrake.pm | |
parent | cc4ed8ffec03196cd9ee56d4dbe1aba685d2409a (diff) | |
download | rpmdrake-5fc500f31f6136a536bf5f9ced146077d589e5fb.tar rpmdrake-5fc500f31f6136a536bf5f9ced146077d589e5fb.tar.gz rpmdrake-5fc500f31f6136a536bf5f9ced146077d589e5fb.tar.bz2 rpmdrake-5fc500f31f6136a536bf5f9ced146077d589e5fb.tar.xz rpmdrake-5fc500f31f6136a536bf5f9ced146077d589e5fb.zip |
(mirrors) add a progress bar while downloading mirrors list & enable
to cancel it (#34630)
Diffstat (limited to 'rpmdrake.pm')
-rw-r--r-- | rpmdrake.pm | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/rpmdrake.pm b/rpmdrake.pm index 1d86e371..36db11ac 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -510,7 +510,7 @@ sub mirrors { unlink $file; # prevent "partial file" errors before_leaving(sub { unlink $file }); - my $id; + my ($gurpm, $id, $canceled); # display a message in statusbar (if availlable): $::statusbar and $id = statusbar_msg( $branded @@ -518,12 +518,26 @@ sub mirrors { : N("Please wait, downloading mirror addresses from the Mandriva website."), 0); my $_clean_guard = before_leaving { + undef $gurpm; $id and statusbar_msg_remove($id); }; - my $res = urpm::download::sync($urpm, undef, [ $url ], dir => $cachedir); + require Rpmdrake::gurpm; + require Rpmdrake::pkg; + + my $res = urpm::download::sync($urpm, undef, [ $url ], + dir => $cachedir, + callback => sub { + $gurpm ||= + Rpmdrake::gurpm->new(N("Please wait"), + transient => $::main_window); + $canceled ||= + !Rpmdrake::pkg::download_callback($gurpm, @_); + gtkflush(); + }, + ); $res or do { c::set_tagged_utf8($res); die $res }; - return cat_($file); + return $canceled ? () : cat_($file); }); my @mirrors = @{ mirror::list(common::parse_LDAP_namespace_structure(cat_('/etc/product.id')), 'distrib') || [] }; require timezone; |