aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--Rpmdrake/gurpm.pm5
2 files changed, 7 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 579a3ead..d11b4e35 100644
--- a/NEWS
+++ b/NEWS
@@ -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;
}