[gnome-packagekit] Use pk_client_set_cache_age() to optimize the amount of downloaded data



commit 35f35fca097d73e6b2b2c9e9295a8eddbcc63294
Author: Richard Hughes <richard hughsie com>
Date:   Tue Nov 2 12:57:34 2010 +0000

    Use pk_client_set_cache_age() to optimize the amount of downloaded data

 src/gpk-check-update.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/gpk-check-update.c b/src/gpk-check-update.c
index a82bcd3..54a1fde 100644
--- a/src/gpk-check-update.c
+++ b/src/gpk-check-update.c
@@ -1042,6 +1042,13 @@ gpk_check_update_query_updates (GpkCheckUpdate *cupdate)
 		goto out;
 	}
 
+#if PK_CHECK_VERSION(0,6,10)
+	/* optimize the amount of downloaded data by setting the cache age */
+	pk_client_set_cache_age (PK_CLIENT(cupdate->priv->task),
+				 g_settings_get_int (cupdate->priv->settings,
+						     GPK_SETTINGS_FREQUENCY_GET_UPDATES));
+#endif
+
 	/* get new update list */
 	pk_client_get_updates_async (PK_CLIENT(cupdate->priv->task),
 				     pk_bitfield_value (PK_FILTER_ENUM_NONE),
@@ -1187,6 +1194,13 @@ gpk_check_update_auto_refresh_cache_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate
 		goto out;
 	}
 
+#if PK_CHECK_VERSION(0,6,10)
+	/* optimize the amount of downloaded data by setting the cache age */
+	pk_client_set_cache_age (PK_CLIENT(cupdate->priv->task),
+				 g_settings_get_int (cupdate->priv->settings,
+						     GPK_SETTINGS_FREQUENCY_REFRESH_CACHE));
+#endif
+
 	pk_client_refresh_cache_async (PK_CLIENT(cupdate->priv->task), TRUE, cupdate->priv->cancellable, NULL, NULL,
 				       (GAsyncReadyCallback) gpk_check_update_refresh_cache_finished_cb, cupdate);
 out:
@@ -1319,6 +1333,13 @@ gpk_check_update_auto_get_upgrades_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate
 		goto out;
 	}
 
+#if PK_CHECK_VERSION(0,6,10)
+	/* optimize the amount of downloaded data by setting the cache age */
+	pk_client_set_cache_age (PK_CLIENT(cupdate->priv->task),
+				 g_settings_get_int (cupdate->priv->settings,
+						     GPK_SETTINGS_FREQUENCY_GET_UPGRADES));
+#endif
+
 	/* get new distro upgrades list */
 	pk_client_get_distro_upgrades_async (PK_CLIENT(cupdate->priv->task), cupdate->priv->cancellable, NULL, NULL,
 					     (GAsyncReadyCallback) gpk_check_update_get_distro_upgrades_finished_cb, cupdate);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]