From cd149734943cb3afee3189320d68df3cc7c58eed Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 2 Sep 2005 09:05:09 +0000 Subject: fs::format::wait_message() is now ->wait_message_with_progress_bar (on interactive objects) --- perl-install/diskdrake/interactive.pm | 2 +- perl-install/fs/format.pm | 33 ------------------------------- perl-install/install_any.pm | 2 +- perl-install/install_steps_interactive.pm | 2 +- perl-install/interactive.pm | 33 +++++++++++++++++++++++++++++++ 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index aeccf5e01..e2c666212 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -1140,7 +1140,7 @@ sub format_ { fs::format::check_package_is_installed($in->do_pkgs, $part->{fs_type}) or return; } $part->{isFormatted} = 0; #- force format; - my ($_w, $wait_message) = fs::format::wait_message($in); + my ($_w, $wait_message) = $in->wait_message_with_progress_bar; fs::format::part($all_hds, $part, $wait_message); 1; } diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm index 7975074ea..a92db89f7 100644 --- a/perl-install/fs/format.pm +++ b/perl-install/fs/format.pm @@ -148,39 +148,6 @@ sub disable_forced_fsck { run_program::run("tune2fs", "-c0", "-i0", devices::make($dev)); } -sub wait_message { - my ($in) = @_; - - my ($w, $progress, $last_msg, $displayed); - my $on_expose = sub { $displayed = 1; 0 }; #- declared here to workaround perl limitation - $w, sub { - my ($msg, $current, $total) = @_; - if ($msg) { - $last_msg = $msg; - if (!$w) { - $progress = Gtk2::ProgressBar->new if $in->isa('interactive::gtk'); - $w = $in->wait_message('', [ '', if_($progress, $progress) ]); - if ($progress) { - #- don't show by default, only if we are given progress information - $progress->hide; - $progress->signal_connect(expose_event => $on_expose); - } - } - $w->set($msg); - } elsif ($total) { - if ($progress) { - $progress->set_fraction($current / $total); - $progress->show; - $displayed = 0; - mygtk2::flush() while !$displayed; - } else { - $w->set([ $last_msg, "$current / $total" ]); - } - } - }; -} - - sub formatMount_part { my ($part, $all_hds, $fstab, $wait_message) = @_; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index ca1f00a2e..cf4030cce 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -749,7 +749,7 @@ Please insert the Cd-Rom labelled \"%s\" in your drive and press Ok when done.", my $m = install_medium::by_id($k, $o->{packages}); #- don't copy rpms of supplementary media next if $m->is_suppl; - my ($wait_w, $wait_message) = fs::format::wait_message($o); #- nb, this is only called when interactive + my ($wait_w, $wait_message) = $o->wait_message_with_progress_bar; #- nb, this is only called when interactive $wait_message->(N("Copying in progress") . "\n($m->{descr})"); #- XXX to be translated if ($k != $current_medium) { my $cd_k = $m->get_cd_number; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 1ebe1319f..a87b4caf5 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -382,7 +382,7 @@ sub choosePartitionsToFormat { sub formatMountPartitions { my ($o, $_fstab) = @_; - my ($w, $wait_message) = fs::format::wait_message($o); + my ($w, $wait_message) = $o->wait_message_with_progress_bar; catch_cdie { fs::format::formatMount_all($o->{all_hds}, $o->{fstab}, $wait_message); } sub { diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index b93df4bdb..3cf092052 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -480,6 +480,39 @@ sub wait_message { $b; } + +sub wait_message_with_progress_bar { + my ($in) = @_; + + my ($w, $progress, $last_msg, $displayed); + my $on_expose = sub { $displayed = 1; 0 }; #- declared here to workaround perl limitation + $w, sub { + my ($msg, $current, $total) = @_; + if ($msg) { + $last_msg = $msg; + if (!$w) { + $progress = Gtk2::ProgressBar->new if $in->isa('interactive::gtk'); + $w = $in->wait_message('', [ '', if_($progress, $progress) ]); + if ($progress) { + #- don't show by default, only if we are given progress information + $progress->hide; + $progress->signal_connect(expose_event => $on_expose); + } + } + $w->set($msg); + } elsif ($total) { + if ($progress) { + $progress->set_fraction($current / $total); + $progress->show; + $displayed = 0; + mygtk2::flush() while !$displayed; + } else { + $w->set([ $last_msg, "$current / $total" ]); + } + } + }; +} + sub kill() {} -- cgit v1.2.1