diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-02-20 17:49:50 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-02-20 17:49:50 +0000 |
commit | 218caed4bceb0522f8f72790af103b7319c33e8a (patch) | |
tree | 1929e0cf2b71586c2c6371f718b2be0e5f27f307 /perl-install/install_steps_gtk.pm | |
parent | d2671c4d2795f249da912a1e7998e33011aaf3e3 (diff) | |
download | drakx-backup-do-not-use-218caed4bceb0522f8f72790af103b7319c33e8a.tar drakx-backup-do-not-use-218caed4bceb0522f8f72790af103b7319c33e8a.tar.gz drakx-backup-do-not-use-218caed4bceb0522f8f72790af103b7319c33e8a.tar.bz2 drakx-backup-do-not-use-218caed4bceb0522f8f72790af103b7319c33e8a.tar.xz drakx-backup-do-not-use-218caed4bceb0522f8f72790af103b7319c33e8a.zip |
better advertising support
Diffstat (limited to 'perl-install/install_steps_gtk.pm')
-rw-r--r-- | perl-install/install_steps_gtk.pm | 51 |
1 files changed, 36 insertions, 15 deletions
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)); |