[gnome-packagekit/gnome-2-28] Do not attempt to refresh the updates list when a transaction is running



commit 19250eff692a8c94db5c83319e77b88bf70d9b7d
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 20 17:57:15 2012 +0000

    Do not attempt to refresh the updates list when a transaction is running
    
    If a package adds or removes a .repo file during a transaction, the
    ::RepoListChanged() signal gets sent from PackageKit. If a tranaction is already
    running, then just ignore the signal and continue the transaction like normal.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=744980

 src/gpk-update-viewer.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 7ee488c..ba0afef 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -2206,7 +2206,24 @@ gpk_update_viewer_error_code_cb (PkClient *client, PkErrorCodeEnum code, const g
 static void
 gpk_update_viewer_repo_list_changed_cb (PkClient *client, gpointer data)
 {
+	gboolean ret;
+	GError *error = NULL;
+	PkRoleEnum role = PK_ROLE_ENUM_UNKNOWN;
+
+	/* are we in a transaction */
+	ret = pk_client_get_role (client_primary, &role, NULL, &error);
+	if (!ret) {
+		egg_warning ("failed to get role: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+	if (role != PK_ROLE_ENUM_UNKNOWN) {
+		egg_debug ("already in a transaction, so ignoring");
+		goto out;
+	}
 	gpk_update_viewer_get_new_update_list ();
+out:
+	return;
 }
 
 /**



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