summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Mac-Vicar P <dmacvicar@suse.de>2011-04-27 15:03:39 +0200
committerDuncan Mac-Vicar P <dmacvicar@suse.de>2011-04-27 15:03:39 +0200
commit57bedddc2d0eec1c6efd7ff6305431b5b9000e6b (patch)
treef5471cb7e48391c0b35db7c48341b4360252119f
parentf21741b6c5567affcbd234fc6dc792c227815edc (diff)
Report download speed (bnc#663069)
-rw-r--r--backends/zypp/zypp-events.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/backends/zypp/zypp-events.h b/backends/zypp/zypp-events.h
index cd8f4f35d..5877f8dd3 100644
--- a/backends/zypp/zypp-events.h
+++ b/backends/zypp/zypp-events.h
@@ -30,7 +30,7 @@
#include <pk-backend.h>
#include <zypp/ZYppCallbacks.h>
#include <zypp/Digest.h>
-#include <zypp/KeyRing.h>
+#include <zypp/KeyRing.h>
#include "zypp-utils.h"
@@ -163,6 +163,12 @@ struct ZyppBackendReceiver
pk_backend_set_sub_percentage (_backend, _sub_percentage);
}
+ inline void
+ update_speed (guint speed)
+ {
+ pk_backend_set_speed (_backend, speed);
+ }
+
void
reset_sub_percentage ()
{
@@ -310,8 +316,10 @@ struct DownloadProgressReportReceiver : public zypp::callback::ReceiveReport<zyp
virtual bool progress (int value, const zypp::Url &file, double dbps_avg, double dbps_current)
{
//fprintf (stderr, "\n\n----> DownloadProgressReportReceiver::progress(), %s:%d\n\n", _package_id == NULL ? "unknown" : _package_id, value);
- if (_package_id != NULL)
+ if (_package_id != NULL) {
update_sub_percentage (value);
+ update_speed (static_cast<guint>(dbps_current));
+ }
return true;
}