[gnome-packagekit] Correctly count the list of packages in the update viewer



commit 0ad1817ff278fd58fe3a998d8bd5c1bea9b59f0e
Author: Richard Hughes <richard hughsie com>
Date:   Tue Sep 20 12:49:46 2011 +0100

    Correctly count the list of packages in the update viewer
    
    Otherwise we list extra entries in the status text at the bottom.

 src/gpk-update-viewer.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index f46af5c..84d6523 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -1143,7 +1143,9 @@ gpk_update_viewer_get_install_package_ids (void)
 				    GPK_UPDATES_COLUMN_ID, &package_id, -1);
 
 		/* if selected, and not added previously because of deps */
-		if (update && gpk_update_viewer_info_is_update_enum (info))
+		if (package_id != NULL &&
+		    update &&
+		    gpk_update_viewer_info_is_update_enum (info))
 			g_ptr_array_add (array, package_id);
 		else
 			g_free (package_id);
@@ -1306,6 +1308,7 @@ gpk_update_viewer_update_global_state_recursive (GtkTreeModel *model, GtkTreeIte
 	gboolean selected;
 	PkRestartEnum restart;
 	guint size;
+	gchar *package_id = NULL;
 	gboolean child_valid;
 	GtkTreeIter child_iter;
 
@@ -1313,8 +1316,9 @@ gpk_update_viewer_update_global_state_recursive (GtkTreeModel *model, GtkTreeIte
 			    GPK_UPDATES_COLUMN_SELECT, &selected,
 			    GPK_UPDATES_COLUMN_RESTART, &restart,
 			    GPK_UPDATES_COLUMN_SIZE, &size,
+			    GPK_UPDATES_COLUMN_ID, &package_id,
 			    -1);
-	if (selected) {
+	if (selected && package_id != NULL) {
 		size_total += size;
 		number_total++;
 		if (restart > restart_worst)
@@ -1327,7 +1331,7 @@ gpk_update_viewer_update_global_state_recursive (GtkTreeModel *model, GtkTreeIte
 		gpk_update_viewer_update_global_state_recursive (model, &child_iter);
 		child_valid = gtk_tree_model_iter_next (model, &child_iter);
 	}
-
+	g_free (package_id);
 }
 
 /**



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