diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-02-15 19:31:36 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-02-15 19:31:36 +0000 |
commit | 6b7588c497ad9a6c551efad97f7a8ea58fd445bf (patch) | |
tree | 74f96b68b23d831816c8fac18f09423c21d4327c | |
parent | e948a8c125fcdedd7f126d24ee499a6edd316574 (diff) | |
download | rpmdrake-6b7588c497ad9a6c551efad97f7a8ea58fd445bf.tar rpmdrake-6b7588c497ad9a6c551efad97f7a8ea58fd445bf.tar.gz rpmdrake-6b7588c497ad9a6c551efad97f7a8ea58fd445bf.tar.bz2 rpmdrake-6b7588c497ad9a6c551efad97f7a8ea58fd445bf.tar.xz rpmdrake-6b7588c497ad9a6c551efad97f7a8ea58fd445bf.zip |
(progress) limit progress bar refreshes to 3 per second max (mga#2775)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Rpmdrake/gurpm.pm | 5 |
2 files changed, 7 insertions, 0 deletions
@@ -1,3 +1,5 @@ +- limit progress bar refreshes to 3 per second max (mga#2775) + Version 5.27 - 10 December 2011, Thierry Vignaud - fix opening URLs in root's firefox in some cases by redefining HOME (mga#287) diff --git a/Rpmdrake/gurpm.pm b/Rpmdrake/gurpm.pm index 3a9017c9..ea77d419 100644 --- a/Rpmdrake/gurpm.pm +++ b/Rpmdrake/gurpm.pm @@ -28,6 +28,8 @@ use lib qw(/usr/lib/libDrakX); use mygtk2 qw(gtknew); #- do not import anything else, especially gtkadd() which conflicts with ugtk2 one use ugtk2 qw(:all); use base qw(ugtk2); +use Time::HiRes; +use feature 'state'; sub new { @@ -61,9 +63,12 @@ sub label { sub progress { my ($self, $fraction) = @_; + state $time; $fraction = 0 if $fraction < 0; $fraction = 1 if 1 < $fraction; $self->{progressbar}->set_fraction($fraction); + return if Time::HiRes::clock_gettime() - $time < 0.333; + $time = Time::HiRes::clock_gettime(); $self->flush; } |