[PackageKit-commit] packagekit: Branch 'master' - 5 commits

Richard Hughes hughsient at kemper.freedesktop.org
Thu May 1 15:12:10 PDT 2008


 client/pk-monitor.c  |    8 ++++++--
 src/pk-backend.c     |   13 -------------
 src/pk-transaction.c |   15 ++++++++++-----
 3 files changed, 16 insertions(+), 20 deletions(-)

New commits:
commit 34f104af659b20d2491d7c074dcba149a876772f
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu May 1 23:11:27 2008 +0100

    don't inhibit by default. THIS MEANS BACKENDS SHOULD CALL pk_backend_set_allow_cancel(FALSE) if they need to inhibit at startup

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index c7a3291..2239eeb 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -888,11 +888,6 @@ pk_transaction_run (PkTransaction *transaction)
 	g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
 
 	ret = pk_transaction_set_running (transaction);
-	if (ret) {
-		/* we start inhibited, it's up to the backed to
-		 * release early if a shutdown is possible */
-		pk_inhibit_add (transaction->priv->inhibit, transaction);
-	}
 	return ret;
 }
 
commit 5939f0c1e7d549d986225f60bf9f5b1cff1e85d7
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu May 1 23:07:24 2008 +0100

    only do the inhibit in the transaction, not the backend+transaction so we can sleep when downloading

diff --git a/src/pk-backend.c b/src/pk-backend.c
index c331bbe..004ad62 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -39,7 +39,6 @@
 #include "pk-backend-internal.h"
 #include "pk-backend.h"
 #include "pk-time.h"
-#include "pk-inhibit.h"
 #include "pk-file-monitor.h"
 
 #define PK_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_BACKEND, PkBackendPrivate))
@@ -94,7 +93,6 @@ struct _PkBackendPrivate
 	PkRoleEnum		 role; /* this never changes for the lifetime of a transaction */
 	PkStatusEnum		 status; /* this changes */
 	PkExitEnum		 exit;
-	PkInhibit		*inhibit;
 	PkFileMonitor		*file_monitor;
 	PkBackendFileChanged	 file_changed_func;
 	gpointer		 file_changed_data;
@@ -1269,12 +1267,6 @@ pk_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel)
 		return FALSE;
 	}
 
-	/* remove or add the hal inhibit */
-	if (allow_cancel) {
-		pk_inhibit_remove (backend->priv->inhibit, backend);
-	} else {
-		pk_inhibit_add (backend->priv->inhibit, backend);
-	}
 
 	/* can we do the action? */
 	if (backend->desc->cancel != NULL) {
@@ -1452,9 +1444,6 @@ pk_backend_finished (PkBackend *backend)
 	/* we can't ever be re-used */
 	backend->priv->finished = TRUE;
 
-	/* remove any inhibit */
-	pk_inhibit_remove (backend->priv->inhibit, backend);
-
 	/* we have to run this idle as the command may finish before the transaction
 	 * has been sent to the client. I love async... */
 	pk_debug ("adding finished %p to timeout loop", backend);
@@ -1670,7 +1659,6 @@ pk_backend_finalize (GObject *object)
 	g_free (backend->priv->name);
 	g_free (backend->priv->c_tid);
 	g_object_unref (backend->priv->time);
-	g_object_unref (backend->priv->inhibit);
 	g_object_unref (backend->priv->network);
 	g_hash_table_destroy (backend->priv->eulas);
 	g_hash_table_unref (backend->priv->hash_string);
@@ -1818,7 +1806,6 @@ pk_backend_init (PkBackend *backend)
 	backend->priv->during_initialize = FALSE;
 	backend->priv->time = pk_time_new ();
 	backend->priv->network = pk_network_new ();
-	backend->priv->inhibit = pk_inhibit_new ();
 	backend->priv->eulas = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	backend->priv->hash_string = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 	backend->priv->hash_strv = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 45f8f91..c7a3291 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -325,6 +325,13 @@ pk_transaction_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkTra
 	pk_debug ("AllowCancel now %i", allow_cancel);
 	transaction->priv->allow_cancel = allow_cancel;
 
+	/* remove or add the hal inhibit */
+	if (allow_cancel) {
+		pk_inhibit_remove (transaction->priv->inhibit, transaction);
+	} else {
+		pk_inhibit_add (transaction->priv->inhibit, transaction);
+	}
+
 	pk_debug ("emitting allow-interrpt %i", allow_cancel);
 	g_signal_emit (transaction, signals [PK_TRANSACTION_ALLOW_CANCEL], 0, allow_cancel);
 }
@@ -474,6 +481,9 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
 		pk_transaction_db_set_finished (transaction->priv->transaction_db, transaction->priv->tid, FALSE, time);
 	}
 
+	/* remove any inhibit */
+	pk_inhibit_remove (transaction->priv->inhibit, transaction);
+
 	/* disconnect these straight away, as the PkTransaction object takes time to timeout */
 	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_allow_cancel);
 	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_description);
commit 12db8754d737d7941c2f161a46a9e79e509505b2
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu May 1 23:06:25 2008 +0100

    Revert "increase the severity of a mismatched inhibit"
    
    This reverts commit 28c491405d150d4f8bdea15c21682398d6364bc7.

diff --git a/src/pk-inhibit.c b/src/pk-inhibit.c
index 3ba2656..1b93670 100644
--- a/src/pk-inhibit.c
+++ b/src/pk-inhibit.c
@@ -163,7 +163,7 @@ pk_inhibit_add (PkInhibit *inhibit, gpointer data)
 
 	for (i=0; i<inhibit->priv->array->len; i++) {
 		if (g_ptr_array_index (inhibit->priv->array, i) == data) {
-			pk_warning ("trying to add item %p already in array", data);
+			pk_debug ("trying to add item %p already in array", data);
 			return FALSE;
 		}
 	}
@@ -195,7 +195,7 @@ pk_inhibit_remove (PkInhibit *inhibit, gpointer data)
 			return ret;
 		}
 	}
-	pk_warning ("cannot find item %p", data);
+	pk_debug ("cannot find item %p", data);
 	return FALSE;
 }
 
commit f04a94942cd82adba259638b2c5a4cd9cd759390
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu May 1 23:05:47 2008 +0100

    fix the locked callback in pkmon

diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index 2d5114a..ddd33d7 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -74,9 +74,13 @@ pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, gpointe
  * pk_monitor_locked_cb:
  **/
 static void
-pk_monitor_locked_cb (PkControl *control, gpointer data)
+pk_monitor_locked_cb (PkControl *control, gboolean is_locked, gpointer data)
 {
-	g_print ("locked\n");
+	if (is_locked) {
+		g_print ("locked\n");
+	} else {
+		g_print ("unlocked\n");
+	}
 }
 
 /**
commit 28c491405d150d4f8bdea15c21682398d6364bc7
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu May 1 22:55:09 2008 +0100

    increase the severity of a mismatched inhibit

diff --git a/src/pk-inhibit.c b/src/pk-inhibit.c
index 1b93670..3ba2656 100644
--- a/src/pk-inhibit.c
+++ b/src/pk-inhibit.c
@@ -163,7 +163,7 @@ pk_inhibit_add (PkInhibit *inhibit, gpointer data)
 
 	for (i=0; i<inhibit->priv->array->len; i++) {
 		if (g_ptr_array_index (inhibit->priv->array, i) == data) {
-			pk_debug ("trying to add item %p already in array", data);
+			pk_warning ("trying to add item %p already in array", data);
 			return FALSE;
 		}
 	}
@@ -195,7 +195,7 @@ pk_inhibit_remove (PkInhibit *inhibit, gpointer data)
 			return ret;
 		}
 	}
-	pk_debug ("cannot find item %p", data);
+	pk_warning ("cannot find item %p", data);
 	return FALSE;
 }
 


More information about the PackageKit-commit mailing list