[packagekit] packagekit: Branch 'master'
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Feb 11 10:27:57 PST 2008
src/pk-backend.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
New commits:
commit e09f2f8b88a8592c2ed8e7a9af7aec548ab83d66
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 11 18:24:22 2008 +0000
some fixes when we set the backend percentage the same as last time, and when we pass it 101
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 465507e..10cc20e 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -246,15 +246,24 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ /* set the same twice? */
+ if (backend->priv->last_percentage == percentage) {
+ pk_debug ("duplicate set of %i", percentage);
+ return FALSE;
+ }
+
/* save in case we need this from coldplug */
backend->priv->last_percentage = percentage;
- /* needed for time remaining calculation */
- pk_time_add_data (backend->priv->time, percentage);
+ /* only compute time if we have data */
+ if (percentage != PK_BACKEND_PERCENTAGE_INVALID) {
+ /* needed for time remaining calculation */
+ pk_time_add_data (backend->priv->time, percentage);
- /* TODO: lets try this */
- backend->priv->last_remaining = pk_time_get_remaining (backend->priv->time);
- pk_debug ("this will now take ~%i seconds", backend->priv->last_remaining);
+ /* lets try this and print as debug */
+ backend->priv->last_remaining = pk_time_get_remaining (backend->priv->time);
+ pk_debug ("this will now take ~%i seconds", backend->priv->last_remaining);
+ }
/* emit the progress changed signal */
pk_backend_emit_progress_changed (backend);
@@ -282,6 +291,12 @@ pk_backend_set_sub_percentage (PkBackend *backend, guint percentage)
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ /* set the same twice? */
+ if (backend->priv->last_subpercentage == percentage) {
+ pk_debug ("duplicate set of %i", percentage);
+ return FALSE;
+ }
+
/* save in case we need this from coldplug */
backend->priv->last_subpercentage = percentage;
More information about the PackageKit
mailing list