[packagekit] [PATCH 4/4] Get detail info for dependency packages

Zhang Qiang qiang.z.zhang at intel.com
Sat Sep 25 20:04:16 PDT 2010


This patch provide the function to get the package/update details
information for dependency packages.

without this patch, the details info of dependency package is empty.

Related MeeGo bug: BMC#6616,6617.
---
 src/gpk-update-viewer.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 0bde267..142fb0b 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -50,6 +50,9 @@
 
 #define GPK_UPDATE_VIEWER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_UPDATE_VIEWER, GpkUpdateViewerPrivate))
 
+static void gpk_update_viewer_get_update_detail_cb (PkClient *client, GAsyncResult *res, GpkUpdateViewer *update_viewer);
+static void gpk_update_viewer_get_details_cb (PkClient *client, GAsyncResult *res, GpkUpdateViewer *update_viewer);
+
 struct GpkUpdateViewerPrivate
 {
 	gboolean		 ignore_updates_changed;
@@ -927,6 +930,8 @@ gpk_update_viewer_progress_cb (PkProgress *progress, PkProgressType type, GpkUpd
 		/* update icon */
 		path = gpk_update_viewer_model_get_path (model, package_id);
 		if (path == NULL) {
+			gchar **package_ids;
+
 			/* find our parent */
 			ret = gpk_update_viewer_find_parent (update_viewer, package_id, &parent);
 
@@ -958,6 +963,17 @@ gpk_update_viewer_progress_cb (PkProgress *progress, PkProgressType type, GpkUpd
 				egg_warning ("found no package %s", package_id);
 				goto out;
 			}
+
+			package_ids = pk_package_ids_from_string (package_id);
+			/* get the details of dependency packages */
+			pk_client_get_update_detail_async (PK_CLIENT(priv->task), package_ids, priv->cancellable,
+						   (PkProgressCallback) gpk_update_viewer_progress_cb, update_viewer,
+						   (GAsyncReadyCallback) gpk_update_viewer_get_update_detail_cb, update_viewer);
+			/* get the size of dependency packages */
+			pk_client_get_details_async (PK_CLIENT(priv->task), package_ids, priv->cancellable,
+						     (PkProgressCallback) gpk_update_viewer_progress_cb, update_viewer,
+						     (GAsyncReadyCallback) gpk_update_viewer_get_details_cb, update_viewer);
+			g_strfreev(package_ids);
 		}
 
 		gtk_tree_model_get_iter (model, &iter, path);
-- 
1.7.2.2




More information about the PackageKit mailing list