diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-01-15 17:08:43 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-01-15 17:08:43 +0000 |
commit | ee9bc5ffb7cf8c4b42a0ebe4137f484e1455b353 (patch) | |
tree | 0b09ef5e4a6b277abda02538382e4da9bd59fbe1 /perl-install/fs/format.pm | |
parent | bc17d25e2512522de0e7bc0dda18ec49d1021fd5 (diff) | |
download | drakx-backup-do-not-use-ee9bc5ffb7cf8c4b42a0ebe4137f484e1455b353.tar drakx-backup-do-not-use-ee9bc5ffb7cf8c4b42a0ebe4137f484e1455b353.tar.gz drakx-backup-do-not-use-ee9bc5ffb7cf8c4b42a0ebe4137f484e1455b353.tar.bz2 drakx-backup-do-not-use-ee9bc5ffb7cf8c4b42a0ebe4137f484e1455b353.tar.xz drakx-backup-do-not-use-ee9bc5ffb7cf8c4b42a0ebe4137f484e1455b353.zip |
gtk2 progress bar when formatting ext3
Diffstat (limited to 'perl-install/fs/format.pm')
-rw-r--r-- | perl-install/fs/format.pm | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm index 7032f3413..0bae41ce8 100644 --- a/perl-install/fs/format.pm +++ b/perl-install/fs/format.pm @@ -105,7 +105,8 @@ sub mke2fs { local $/ = "\b"; local $_; while (<$F>) { - $wait_message->('', $1, $2) if m!^\s*(\d+)/(\d+)\b!; + #- when this is over, it still takes some time, hence the 85% + $wait_message->('', $1, int($2 / 0.85)) if m!^\s*(\d+)/(\d+)\b!; } return close($F); } @@ -118,14 +119,31 @@ sub disable_forced_fsck { sub wait_message { my ($in) = @_; - my $w; + my ($w, $progress, $last_msg, $displayed); $w, sub { my ($msg, $current, $total) = @_; if ($msg) { - $w ||= $in->wait_message('', $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 => sub { $displayed = 1; 0 }); + } + } $w->set($msg); } elsif ($total) { - $w->set("$current / $total"); + log::l("set_fraction $current / $total"); + if ($progress) { + $progress->set_fraction($current / $total); + $progress->show; + $displayed = 0; + mygtk2::flush() while !$displayed; + } else { + $w->set([ $last_msg, "$current / $total" ]); + } } }; } |