[packagekit] packagekit: Branch 'master' - 3 commits

Richard Hughes hughsient at kemper.freedesktop.org
Sun Oct 7 09:42:50 PDT 2007


 libpackagekit/pk-task-list.c |   23 +++++++++++++++++++++++
 libpackagekit/pk-task-list.h |    2 ++
 src/pk-engine.c              |   10 ++++++++++
 src/pk-transaction-db.c      |    4 ++--
 4 files changed, 37 insertions(+), 2 deletions(-)

New commits:
diff-tree 3e0038355bfeb267b8afd2b401c08c675575e85f (from a1e38d00be13906cd5223d5d249118a02c5c3426)
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 7 17:39:51 2007 +0100

    order by timespec not by transaction_id

diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 3da818b..bfbafeb 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -195,10 +195,10 @@ pk_transaction_db_get_list (PkTransactio
 
 	if (limit == 0) {
 		statement = g_strdup ("SELECT transaction_id, timespec, succeeded, duration, role, data "
-				      "FROM transactions ORDER BY transaction_id");
+				      "FROM transactions ORDER BY timespec DESC");
 	} else {
 		statement = g_strdup_printf ("SELECT transaction_id, timespec, succeeded, duration, role, data "
-					     "FROM transactions ORDER BY transaction_id DESC LIMIT %i", limit);
+					     "FROM transactions ORDER BY timespec DESC LIMIT %i", limit);
 	}
 	pk_transaction_db_sql_statement (tdb, statement);
 	g_free (statement);
diff-tree a1e38d00be13906cd5223d5d249118a02c5c3426 (from 918f951acb3fa1ec37f54df5b433681742447608)
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 7 15:41:03 2007 +0100

    clear the update cache if we have just finished a system or package update

diff --git a/src/pk-engine.c b/src/pk-engine.c
index 8adbab3..8f658b3 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -483,6 +483,16 @@ pk_engine_finished_cb (PkBackend *backen
 		g_object_add_weak_pointer (G_OBJECT (engine->priv->updates_cache), (gpointer) &engine->priv->updates_cache);
 	}
 
+	/* we unref the update cache if it exists */
+	if (role == PK_ROLE_ENUM_UPDATE_SYSTEM ||
+	    role == PK_ROLE_ENUM_UPDATE_PACKAGE) {
+		if (engine->priv->updates_cache != NULL) {
+			pk_debug ("unreffing updates cache as we have just finished an update");
+			g_object_unref (engine->priv->updates_cache);
+			engine->priv->updates_cache = NULL;
+		}
+	}
+
 	/* find the length of time we have been running */
 	time = pk_backend_get_runtime (backend);
 
diff-tree 918f951acb3fa1ec37f54df5b433681742447608 (from 2211f690cac32b5a2afce22b4cb5d85f132409ab)
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 7 15:17:38 2007 +0100

    add pk_task_list_contains_role so we can see if a task is in the task list

diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index 74d6ae5..d1f0ea0 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -90,6 +90,29 @@ pk_task_list_print (PkTaskList *tlist)
 }
 
 /**
+ * pk_task_list_contains_role:
+ **/
+gboolean
+pk_task_list_contains_role (PkTaskList *tlist, PkRoleEnum role)
+{
+	guint i;
+	PkTaskListItem *item;
+	guint length;
+
+	g_return_val_if_fail (tlist != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_TASK_LIST (tlist), FALSE);
+
+	length = tlist->priv->task_list->len;
+	for (i=0; i<length; i++) {
+		item = g_ptr_array_index (tlist->priv->task_list, i);
+		if (item->role == role) {
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
+/**
  * pk_task_list_find_existing_tid:
  **/
 static PkTaskListItem *
diff --git a/libpackagekit/pk-task-list.h b/libpackagekit/pk-task-list.h
index d0a2a0d..d03c54b 100644
--- a/libpackagekit/pk-task-list.h
+++ b/libpackagekit/pk-task-list.h
@@ -64,6 +64,8 @@ PkTaskList	*pk_task_list_new			(void);
 gboolean	 pk_task_list_refresh			(PkTaskList	*tlist);
 gboolean	 pk_task_list_print			(PkTaskList	*tlist);
 gboolean	 pk_task_list_free			(PkTaskList	*tlist);
+gboolean	 pk_task_list_contains_role		(PkTaskList	*tlist,
+							 PkRoleEnum	 role);
 GPtrArray	*pk_task_list_get_latest		(PkTaskList	*tlist);
 
 G_END_DECLS



More information about the PackageKit mailing list