[packagekit] [PATCH] Set transaction as PK_STATUS_ENUM_WAIT once commited

Zhang, Qiang Z qiang.z.zhang at intel.com
Thu Nov 18 23:06:15 PST 2010


Hi Richard,

I have not found the proper way to set the status and emit it to client/GUI. So I export 
pk_transaction_status_changed_emit and make it can be used out of pk-transaction.

If it's OK, I can push it to master.

Thanks
xiaoqiang

-----Original Message-----
From: Zhang, Qiang Z 
Sent: Friday, November 19, 2010 3:12 PM
To: hughsient at gmail.com; packagekit at lists.freedesktop.org
Cc: Zhang, Qiang Z
Subject: [PATCH] Set transaction as PK_STATUS_ENUM_WAIT once commited

The status of transaction should be PK_STATUS_ENUM_WAIT if transaction
is commited and have not been scheduled. Currently, the transaction
status is PK_STATUS_ENUM_WAITING_FOR_AUTH if there're other transactions
work, which would misunderstand the user.
---
 src/pk-transaction-list.c |    4 ++++
 src/pk-transaction.c      |    2 +-
 src/pk-transaction.h      |    4 ++++
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 116c2cf..7350da4 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -42,6 +42,7 @@
 #include "egg-string.h"
 
 #include "pk-conf.h"
+#include "pk-transaction.h"
 #include "pk-transaction-list.h"
 #include "org.freedesktop.PackageKit.Transaction.h"
 
@@ -604,6 +605,9 @@ pk_transaction_list_commit (PkTransactionList *tlist, const gchar *tid)
 	if (pk_transaction_list_number_running (tlist) == 0) {
 		g_debug ("running %s as no others in progress", item->tid);
 		pk_transaction_list_run_item (tlist, item);
+	} else {
+		/* emit status for GUIs */
+		pk_transaction_status_changed_emit (item->transaction, PK_STATUS_ENUM_WAIT);
 	}
 
 	return TRUE;
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 2fc5921..890d397 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -382,7 +382,7 @@ pk_transaction_allow_cancel_emit (PkTransaction *transaction, gboolean allow_can
 /**
  * pk_transaction_status_changed_emit:
  **/
-static void
+void
 pk_transaction_status_changed_emit (PkTransaction *transaction, PkStatusEnum status)
 {
 	g_return_if_fail (PK_IS_TRANSACTION (transaction));
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 99b271f..cbb4822 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -92,6 +92,10 @@ GType		 pk_transaction_error_get_type			(void);
 GType		 pk_transaction_get_type			(void);
 PkTransaction	*pk_transaction_new				(void);
 
+/* Status changed */
+void		pk_transaction_status_changed_emit		(PkTransaction *transaction, 
+								 PkStatusEnum status);
+
 /* go go go! */
 gboolean	 pk_transaction_run				(PkTransaction      *transaction)
 								 G_GNUC_WARN_UNUSED_RESULT;
-- 
1.7.2.2




More information about the PackageKit mailing list