aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-11-30 18:27:10 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-11-30 18:27:10 +0000
commitcee0b7e176a20e0ba8b2c97b27f3a78c6a752b54 (patch)
tree169866020067a68b42e9590da39e44ea6fbaa6ca
parent571c727c30dfbb20705d54b4c4a66291b883c7e6 (diff)
downloadrpmdrake-cee0b7e176a20e0ba8b2c97b27f3a78c6a752b54.tar
rpmdrake-cee0b7e176a20e0ba8b2c97b27f3a78c6a752b54.tar.gz
rpmdrake-cee0b7e176a20e0ba8b2c97b27f3a78c6a752b54.tar.bz2
rpmdrake-cee0b7e176a20e0ba8b2c97b27f3a78c6a752b54.tar.xz
rpmdrake-cee0b7e176a20e0ba8b2c97b27f3a78c6a752b54.zip
Add a "cancel" button in the download progress window (bug 10961).
-rw-r--r--rpmdrake.pm28
1 files changed, 22 insertions, 6 deletions
diff --git a/rpmdrake.pm b/rpmdrake.pm
index dac04dbb..a4987be6 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -263,7 +263,7 @@ sub wait_msg {
);
$label->signal_connect(expose_event => sub { $mainw->{displayed} = 1; 0 });
$mainw->sync until $mainw->{displayed};
- gtkset_mousecursor_wait($mainw->{rwindow}->window);
+ gtkset_mousecursor_wait($mainw->{rwindow}->window) unless $options{no_wait_cursor};
$mainw->flush;
$mainw;
}
@@ -549,16 +549,31 @@ sub show_urpm_progress {
sub update_sources {
my ($urpm, %options) = @_;
- my $w = wait_msg(
- my $label = Gtk2::Label->new(N("Please wait, updating media...")),
- widgets => [ my $pb = gtkset_size_request(Gtk2::ProgressBar->new, 300, -1) ],
+ my $cancel = 0;
+ my $w; my $label; $w = wait_msg(
+ $label = Gtk2::Label->new(N("Please wait, updating media...")),
+ no_wait_cursor => 1,
+ widgets => [
+ (my $pb = gtkset_size_request(Gtk2::ProgressBar->new, 300, -1)),
+ gtkpack(
+ create_hbox(),
+ gtksignal_connect(
+ Gtk2::Button->new(N("Cancel")),
+ clicked => sub {
+ $cancel = 1;
+ $label->set_label(N("Media update cancelled..."));
+ },
+ ),
+ ),
+ ],
);
my @media; @media = @{$options{medialist}} if ref $options{medialist};
my $outerfatal = $urpm->{fatal};
- local $urpm->{fatal} = sub { remove_wait_msg($w); $outerfatal->(@_) };
+ local $urpm->{fatal} = sub { $w->destroy; $outerfatal->(@_) };
$urpm->update_media(
%options,
callback => sub {
+ $cancel and goto cancel_update;
my ($type, $media) = @_;
return if $type !~ /^(?:start|progress|end)$/ && @media && !grep { $_ eq $media } @media;
if ($type eq 'failed') {
@@ -574,7 +589,8 @@ later.",
}
},
);
- remove_wait_msg($w);
+ cancel_update:
+ $w->destroy;
}
sub update_sources_check {