aboutsummaryrefslogtreecommitdiffstats
path: root/Rpmdrake
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-02-20 11:12:52 +0000
committerThierry Vignaud <tv@mandriva.org>2007-02-20 11:12:52 +0000
commitce314ec0fa1de0a34b687fd17e9b49ae02fa3e26 (patch)
treeb1b5083e80e708d8e8ad4e6dbb38f9c52219d567 /Rpmdrake
parente34ef2e1c52e43753825d9ad2a95beb2f994be3f (diff)
downloadrpmdrake-ce314ec0fa1de0a34b687fd17e9b49ae02fa3e26.tar
rpmdrake-ce314ec0fa1de0a34b687fd17e9b49ae02fa3e26.tar.gz
rpmdrake-ce314ec0fa1de0a34b687fd17e9b49ae02fa3e26.tar.bz2
rpmdrake-ce314ec0fa1de0a34b687fd17e9b49ae02fa3e26.tar.xz
rpmdrake-ce314ec0fa1de0a34b687fd17e9b49ae02fa3e26.zip
split gurpm stuff into Rpmdrake::gurpm module
Diffstat (limited to 'Rpmdrake')
-rwxr-xr-xRpmdrake/gurpm.pm86
1 files changed, 86 insertions, 0 deletions
diff --git a/Rpmdrake/gurpm.pm b/Rpmdrake/gurpm.pm
new file mode 100755
index 00000000..220c2eaf
--- /dev/null
+++ b/Rpmdrake/gurpm.pm
@@ -0,0 +1,86 @@
+package Rpmdrake::gurpm;
+#*****************************************************************************
+#
+# Copyright (c) 2002 Guillaume Cottenceau
+# Copyright (c) 2002-2007 Thierry Vignaud <tvignaud@mandriva.com>
+# Copyright (c) 2003, 2004, 2005 MandrakeSoft SA
+# Copyright (c) 2005-2007 Mandriva SA
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#*****************************************************************************
+#
+# $Id$
+
+use strict;
+use lib qw(/usr/lib/libDrakX);
+use mygtk2 qw(gtknew); #- do not import anything else, especially gtkadd() which conflicts with ugtk2 one
+use ugtk2 qw(:all);
+
+
+our ($mainw, $label, $progressbar, $vbox, $cancel, $hbox_cancel);
+
+sub init {
+ my ($title, $initializing, %options) = @_;
+ $mainw = ugtk2->new($title, %options);
+ $label = gtknew('Label', text => $initializing);
+ $progressbar = gtknew('ProgressBar', width => 300);
+ gtkadd($mainw->{window}, $vbox = gtknew('VBox', spacing => 5, border_width => 6, children_tight => [ $label, $progressbar ]));
+ $mainw->{rwindow}->set_position('center-on-parent');
+ $mainw->sync;
+}
+
+sub label {
+ $label->set($_[0]);
+ select(undef, undef, undef, 0.1); #- hackish :-(
+ $mainw->flush;
+}
+
+sub progress {
+ $progressbar->set_fraction($_[0]);
+ $mainw->flush;
+}
+
+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__(
+ gtknew('HButtonBox'),
+ $cancel = gtknew('Button', text => $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 or return;
+ $hbox_cancel->destroy;
+ $mainw->shrink_topwindow;
+}
+
+1;