summaryrefslogtreecommitdiffstats
path: root/gurpm.pm
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2004-01-12 17:16:18 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2004-01-12 17:16:18 +0000
commit787f95ee090fd373a85b0ea92c3b7cd1897d5ed6 (patch)
tree19f173ce4267295abeb7140ba4afc14ad6efd028 /gurpm.pm
parentb34277345fb7338774c2faf60ba8f8d75ef868c6 (diff)
downloadurpmi-787f95ee090fd373a85b0ea92c3b7cd1897d5ed6.tar
urpmi-787f95ee090fd373a85b0ea92c3b7cd1897d5ed6.tar.gz
urpmi-787f95ee090fd373a85b0ea92c3b7cd1897d5ed6.tar.bz2
urpmi-787f95ee090fd373a85b0ea92c3b7cd1897d5ed6.tar.xz
urpmi-787f95ee090fd373a85b0ea92c3b7cd1897d5ed6.zip
add ability to cancel packages downloads
Diffstat (limited to 'gurpm.pm')
-rw-r--r--gurpm.pm26
1 files changed, 23 insertions, 3 deletions
diff --git a/gurpm.pm b/gurpm.pm
index e051f3a6..a8083626 100644
--- a/gurpm.pm
+++ b/gurpm.pm
@@ -24,14 +24,14 @@ use lib qw(/usr/lib/libDrakX);
use ugtk2 qw(:all);
$::isStandalone = 1;
-our ($mainw, $label, $progressbar);
+our ($mainw, $label, $progressbar, $vbox, $cancel, $hbox_cancel);
sub init {
- my ($title, $initializing) = @_;
+ my ($title, $initializing, $cancel_msg, $cancel_cb) = @_;
$mainw = ugtk2->new($title);
$label = Gtk2::Label->new($initializing);
$progressbar = gtkset_size_request(Gtk2::ProgressBar->new, 400, 0);
- gtkadd($mainw->{window}, gtkpack(gtkadd(create_vbox(), $label, $progressbar)));
+ gtkadd($mainw->{window}, gtkpack($vbox = gtkadd(create_vbox(), $label, $progressbar)));
$mainw->{rwindow}->set_position('center');
$mainw->sync;
}
@@ -54,6 +54,26 @@ sub progress {
sub end {
$mainw and $mainw->destroy;
$mainw = undef;
+ $cancel = undef; #- in case we'll do another one later
+}
+
+sub validate_cancel {
+ my ($cancel_msg, $cancel_cb) = @_;
+ if (!$cancel) {
+ gtkpack__($vbox,
+ $hbox_cancel = gtkpack__(create_hbox(),
+ $cancel = gtksignal_connect(Gtk2::Button->new($cancel_msg), clicked => \&$cancel_cb)));
+ }
+ $cancel->set_sensitive(1);
+ $cancel->show;
+}
+
+sub invalidate_cancel {
+ $cancel and $cancel->set_sensitive(0);
+}
+
+sub invalidate_cancel_forever {
+ $hbox_cancel and $hbox_cancel->destroy;
}
1;