diff options
-rw-r--r-- | perl-install/install_any.pm | 4 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 1 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 51 |
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)); |