[gnome-packagekit] Don't show duplicate package names in the reboot tooltip



commit 24463f13f36460ff5c3ce3de669a7251588d4fe9
Author: Richard Hughes <richard hughsie com>
Date:   Fri Sep 4 13:26:38 2009 +0100

    Don't show duplicate package names in the reboot tooltip

 src/gpk-watch.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index a683742..5326931 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -438,7 +438,9 @@ gpk_watch_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum
 	gchar *message = NULL;
 	NotifyNotification *notification;
 #if PK_CHECK_VERSION(0,5,0)
+	guint j;
 	const PkRequireRestartObj *obj;
+	const PkRequireRestartObj *obj_tmp;
 	PkObjList *array;
 #else
 	PkPackageId *id;
@@ -477,8 +479,25 @@ gpk_watch_task_list_finished_cb (PkTaskList *tlist, PkClient *client, PkExitEnum
 			}
 			for (i=0; i<array->len; i++) {
 				obj = pk_obj_list_index (array, i);
-				if (obj->restart >= restart)
-					g_ptr_array_add (watch->priv->restart_package_names, g_strdup (obj->id->name));
+
+				/* is a lesser restart that what we have already */
+				if (obj->restart != restart)
+					continue;
+
+				/* is already in the list */
+				ret = FALSE;
+				for (j=0; j<array->len; j++) {
+					obj_tmp = pk_obj_list_index (array, j);
+					if (g_strcmp0 (obj_tmp->id->name, obj->id->name) == 0) {
+						ret = TRUE;
+						break;
+					}
+				}
+				if (ret)
+					continue;
+
+				/* add to list */
+				g_ptr_array_add (watch->priv->restart_package_names, g_strdup (obj->id->name));
 			}
 			g_object_unref (array);
 no_data:



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