[packagekit] packagekit: Branch 'master'
Richard Hughes
hughsient at kemper.freedesktop.org
Sat Oct 13 13:48:57 PDT 2007
docs/backends.xml | 5 +++++
src/pk-backend.c | 27 +++++++++++++++++++++++++++
src/pk-backend.h | 2 ++
src/pk-engine.c | 23 +++++++++++++++++++++++
4 files changed, 57 insertions(+)
New commits:
commit 667411b5e0e26dcc89fc484bddc1c3b795dcb96a
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Oct 13 21:47:33 2007 +0100
add the change-transaction-data signal callback for the future rollback stuff
diff --git a/docs/backends.xml b/docs/backends.xml
index 51217a4..a0d4b01 100644
--- a/docs/backends.xml
+++ b/docs/backends.xml
@@ -175,6 +175,11 @@
<entry><literal>stdout</literal></entry>
</row>
<row>
+ <entry>ChangeTransactionData</entry>
+ <entry><literal>change-transaction-data[tab]data</literal></entry>
+ <entry><literal>stdout</literal></entry>
+ </row>
+ <row>
<entry>RepoSignatureRequired</entry>
<entry><literal>repository_name[tab]key_url[tab]key_userid[tab]key_id[tab]key_fingerprint[tab]key_timestamp[tab]type</literal></entry>
<entry><literal>stdout</literal></entry>
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 8893af8..ce9e323 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -96,6 +96,7 @@ enum {
PK_BACKEND_UPDATES_CHANGED,
PK_BACKEND_REPO_SIGNATURE_REQUIRED,
PK_BACKEND_REQUIRE_RESTART,
+ PK_BACKEND_CHANGE_TRANSACTION_DATA,
PK_BACKEND_FINISHED,
PK_BACKEND_ALLOW_INTERRUPT,
PK_BACKEND_LAST_SIGNAL
@@ -359,6 +360,13 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
}
restart_enum = pk_restart_enum_from_text (sections[1]);
pk_backend_require_restart (backend, restart_enum, sections[2]);
+ } else if (strcmp (command, "change-transaction-data") == 0) {
+ if (size != 2) {
+ g_warning ("invalid command '%s'", command);
+ ret = FALSE;
+ goto out;
+ }
+ pk_backend_change_transaction_data (backend, sections[1]);
} else if (strcmp (command, "status") == 0) {
if (size != 2) {
g_warning ("invalid command '%s'", command);
@@ -742,6 +750,20 @@ pk_backend_require_restart (PkBackend *backend, PkRestartEnum restart, const gch
}
/**
+ * pk_backend_change_transaction_data:
+ **/
+gboolean
+pk_backend_change_transaction_data (PkBackend *backend, const gchar *data)
+{
+ g_return_val_if_fail (backend != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+
+ pk_debug ("emit change-transaction-data %s", data);
+ g_signal_emit (backend, signals [PK_BACKEND_CHANGE_TRANSACTION_DATA], 0, data);
+ return TRUE;
+}
+
+/**
* pk_backend_description:
**/
gboolean
@@ -1572,6 +1594,11 @@ pk_backend_class_init (PkBackendClass *klass)
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, pk_marshal_VOID__UINT_STRING,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ signals [PK_BACKEND_CHANGE_TRANSACTION_DATA] =
+ g_signal_new ("change-transaction-data",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
signals [PK_BACKEND_DESCRIPTION] =
g_signal_new ("description",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-backend.h b/src/pk-backend.h
index ab50d33..457c464 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -78,6 +78,8 @@ gboolean pk_backend_repo_signature_required (PkBackend *backend
PkSigTypeEnum type);
gboolean pk_backend_spawn_helper (PkBackend *backend,
const gchar *script, ...);
+gboolean pk_backend_change_transaction_data (PkBackend *backend,
+ const gchar *data);
gboolean pk_backend_spawn_kill (PkBackend *backend);
gboolean pk_backend_allow_interrupt (PkBackend *backend,
gboolean allow_restart);
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 334e1b8..e5c66a1 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -572,6 +572,27 @@ pk_engine_allow_interrupt_cb (PkBackend *backend, gboolean allow_kill, PkEngine
}
/**
+ * pk_engine_change_transaction_data_cb:
+ **/
+static void
+pk_engine_change_transaction_data_cb (PkBackend *backend, gchar *data, PkEngine *engine)
+{
+ PkTransactionItem *item;
+
+ g_return_if_fail (engine != NULL);
+ g_return_if_fail (PK_IS_ENGINE (engine));
+
+ item = pk_transaction_list_get_from_backend (engine->priv->transaction_list, backend);
+ if (item == NULL) {
+ pk_warning ("could not find backend");
+ return;
+ }
+
+ /* change the database */
+ pk_warning ("TODO: change the item->tid and resave to database");
+}
+
+/**
* pk_engine_new_backend:
**/
static PkBackend *
@@ -619,6 +640,8 @@ pk_engine_new_backend (PkEngine *engine)
G_CALLBACK (pk_engine_description_cb), engine);
g_signal_connect (backend, "allow-interrupt",
G_CALLBACK (pk_engine_allow_interrupt_cb), engine);
+ g_signal_connect (backend, "change-transaction-data",
+ G_CALLBACK (pk_engine_change_transaction_data_cb), engine);
/* initialise some stuff */
pk_engine_reset_timer (engine);
More information about the PackageKit
mailing list