summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-02-20 17:49:50 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-02-20 17:49:50 +0000
commit218caed4bceb0522f8f72790af103b7319c33e8a (patch)
tree1929e0cf2b71586c2c6371f718b2be0e5f27f307 /perl-install
parentd2671c4d2795f249da912a1e7998e33011aaf3e3 (diff)
downloaddrakx-218caed4bceb0522f8f72790af103b7319c33e8a.tar
drakx-218caed4bceb0522f8f72790af103b7319c33e8a.tar.gz
drakx-218caed4bceb0522f8f72790af103b7319c33e8a.tar.bz2
drakx-218caed4bceb0522f8f72790af103b7319c33e8a.tar.xz
drakx-218caed4bceb0522f8f72790af103b7319c33e8a.zip
better advertising support
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/install_steps.pm1
-rw-r--r--perl-install/install_steps_gtk.pm51
3 files changed, 40 insertions, 16 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 40929ece8..b6f429763 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -91,7 +91,9 @@ sub errorOpeningFile($) {
while ($max > 0 && askChangeMedium($::o->{method}, $asked_medium)) {
$current_medium = $asked_medium;
eval { fs::mount($cdrom, "/tmp/image", "iso9660", 'readonly') };
- my $getFile = getFile($file); $getFile and return $getFile;
+ my $getFile = getFile($file);
+ $getFile and $::o->copy_advertising;
+ $getFile and return $getFile;
$current_medium = 'unknown'; #- don't know what CD is inserted now.
ejectCdrom($cdrom);
--$max;
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 5b70e65f7..e5cd48060 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -272,6 +272,7 @@ sub choosePackages {
$availableCorrected;
}
+sub copy_advertising {}
sub beforeInstallPackages {
my ($o) = @_;
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index 61368b9a9..0f94910ef 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -467,6 +467,27 @@ sub choosePackagesTree {
}
#------------------------------------------------------------------------------
+sub beforeInstallPackages {
+ my ($o) = @_;
+ $o->SUPER::beforeInstallPackages;
+ $o->copy_advertising;
+}
+sub copy_advertising {
+ my ($o) = @_;
+
+ my $f = install_any::getFile('Mandrake/share/advertising/list');
+ if (my @files = <$f>) {
+ my $dir = "$o->{prefix}/tmp/drakx-images";
+ mkdir $dir;
+ unlink glob_("$dir/*");
+ foreach (@files) {
+ chomp;
+ install_any::getAndSaveFile("Mandrake/share/advertising/$_", "$dir/$_");
+ }
+ }
+}
+
+#------------------------------------------------------------------------------
sub installPackages {
my ($o, $packages) = @_;
@@ -479,28 +500,30 @@ sub installPackages {
my ($msg, $msg_time_remaining, $msg_time_total) = map { new Gtk::Label($_) } '', (_("Estimating")) x 2;
my ($progress, $progress_total) = map { new Gtk::ProgressBar } (1..2);
gtkadd($w->{window}, my $box = new Gtk::VBox(0,10));
- $box->pack_end(gtkshow(gtkpack(gtkset_usize(new Gtk::VBox(0,5), $::windowwidth * 0.8, 70),
-# $msg, $progress,
+ $box->pack_end(gtkshow(gtkpack(gtkset_usize(new Gtk::VBox(0,5), $::windowwidth * 0.8, 0),
+ $msg, $progress,
create_packtable({},
[_("Time remaining "), $msg_time_remaining],
# [_("Total time "), $msg_time_total],
),
-# $text,
+ $text,
$progress_total,
gtkadd(create_hbox(),
my $cancel = new Gtk::Button(_("Cancel"))),
- )), 1, 1, 0);
+ )), 0, 1, 0);
$w->sync;
$msg->set(_("Please wait, preparing installation"));
gtkset_mousecursor_normal($cancel->window);
$cancel->signal_connect(clicked => sub { $pkgs::cancel_install = 1 });
- my ($i_image, $i);
- my $nb_images = 6;
-
- my $dir = "$o->{prefix}/tmp/drakx-images"; mkdir $dir;
- install_any::getAndSaveFile("Mandrake/mdkinst$ENV{SHARE_PATH}/ad-$_.png", "$dir/ad-$_.png")
- foreach 0 .. $nb_images-1;
+ my ($change_time, $i);
+ my @images = glob_("$o->{prefix}/tmp/drakx-images/*");
+ if (@images) {
+ log::l("hiding");
+ $msg->hide;
+ $progress->hide;
+ $text->hide;
+ }
my $oldInstallCallback = \&pkgs::installCallback;
local *pkgs::installCallback = sub {
@@ -520,11 +543,9 @@ sub installPackages {
$last_size = c::headerGetEntry(pkgs::packageHeader($p), 'size');
$text->set((split /\n/, c::headerGetEntry(pkgs::packageHeader($p), 'summary'))[0] || '');
- $i++;
- my $old_i_image = $i_image;
- $i_image = int($i / $nb * $nb_images) % $nb_images;
- if ($old_i_image ne $i_image) {
- my $f = "$dir/ad-$i_image.png";
+ if (@images && time() - $change_time > 20) {
+ $change_time = time();
+ my $f = $images[$i++ % @images];
log::l("advertising $f");
gtkdestroy($advertising);
gtkpack($box, $advertising = gtkpng($f));