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

Richard Hughes hughsient at kemper.freedesktop.org
Sun Oct 14 03:46:17 PDT 2007


 TODO                            |    5 
 backends/alpm/pk-backend-alpm.c |    2 
 client/pk-console.c             |   40 ++++++-
 libpackagekit/pk-client.c       |  224 +++++++++++++++++++++++++++++++++++++++-
 libpackagekit/pk-client.h       |   10 +
 libpackagekit/pk-task-list.c    |   21 +++
 src/pk-backend.c                |   87 +++++++++++++++
 src/pk-backend.h                |   14 ++
 src/pk-engine.c                 |  104 +++++++++++++-----
 src/pk-engine.h                 |    2 
 src/pk-interface.xml            |    4 
 src/pk-marshal.list             |    1 
 12 files changed, 478 insertions(+), 36 deletions(-)

New commits:
commit 2eee0dff50d471acb5209c071769698b8339f711
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 11:44:54 2007 +0100

    update TODO

diff --git a/TODO b/TODO
index 0d7f8f3..3ae6fbc 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ Order of no particular importance:
 TimeRemaining()
 
 *** the backends will have repo controls ***
-Add the extra operations in the backend status widget
 Connect up pk-repo to actually get the data
 If pk-repo can't get repos, then display a message and quit
 If repos can't be enabled then grey out check boxes
commit 03ee7ded7e8c12b53cfe9b2c8851278cf18976cf
Merge: fd97471... b6243be...
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 11:33:56 2007 +0100

    Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit

commit b6243be6a04fd12b198596892034a8e70bf49ac6
Author: Andreas Obergrusberger <tradiaz at yahoo.de>
Date:   Sun Oct 14 09:21:38 2007 -0700

    reuse install_package for update_package in alpm

diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 863bf52..0e3af37 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -757,7 +757,7 @@ PK_BACKEND_OPTIONS (
 	NULL,						/* search_file */
 	NULL,						/* search_group */
 	backend_search_name,				/* search_name */
-	NULL,						/* update_package */
+	backend_install_package,			/* update_package */
 	NULL,						/* update_system */
 	NULL,						/* get_repo_list */
 	NULL,						/* repo_enable */
commit fd97471d2328c3ce364110ab3fd5df777581d73f
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 11:33:40 2007 +0100

    we have to use a transaction id method if we call out helpers. fix the repo stuff

diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index ebdb966..d97db80 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -1799,10 +1799,6 @@ pk_client_get_repo_list (PkClient *client)
 	return TRUE;
 }
 
-/******************************************************************************
- *                    NON-TRANSACTION ID METHODS
- ******************************************************************************/
-
 /**
  * pk_client_repo_enable_action:
  **/
@@ -1816,6 +1812,7 @@ pk_client_repo_enable_action (PkClient *client, const gchar *repo_id, gboolean e
 
 	*error = NULL;
 	ret = dbus_g_proxy_call (client->priv->proxy, "RepoEnable", error,
+				 G_TYPE_STRING, client->priv->tid,
 				 G_TYPE_STRING, repo_id,
 				 G_TYPE_BOOLEAN, enabled,
 				 G_TYPE_INVALID,
@@ -1840,6 +1837,13 @@ pk_client_repo_enable (PkClient *client, const gchar *repo_id, gboolean enabled)
 	g_return_val_if_fail (client != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
 
+	/* check to see if we already have a transaction */
+	ret = pk_client_allocate_transaction_id (client);
+	if (ret == FALSE) {
+		pk_warning ("Failed to get transaction ID");
+		return FALSE;
+	}
+
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_REPO_ENABLE;
 
@@ -1880,6 +1884,7 @@ pk_client_repo_set_data_action (PkClient *client, const gchar *repo_id,
 
 	*error = NULL;
 	ret = dbus_g_proxy_call (client->priv->proxy, "RepoSetData", error,
+				 G_TYPE_STRING, client->priv->tid,
 				 G_TYPE_STRING, repo_id,
 				 G_TYPE_STRING, parameter,
 				 G_TYPE_STRING, value,
@@ -1905,6 +1910,13 @@ pk_client_repo_set_data (PkClient *client, const gchar *repo_id, const gchar *pa
 	g_return_val_if_fail (client != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
 
+	/* check to see if we already have a transaction */
+	ret = pk_client_allocate_transaction_id (client);
+	if (ret == FALSE) {
+		pk_warning ("Failed to get transaction ID");
+		return FALSE;
+	}
+
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_REPO_SET_DATA;
 
@@ -1931,6 +1943,10 @@ pk_client_repo_set_data (PkClient *client, const gchar *repo_id, const gchar *pa
 	return ret;
 }
 
+/******************************************************************************
+ *                    NON-TRANSACTION ID METHODS
+ ******************************************************************************/
+
 /**
  * pk_client_get_actions:
  **/
@@ -2377,8 +2393,8 @@ pk_client_init (PkClient *client)
 					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
 
 	/* RepoDetail */
-	dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_BOOL,
-					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
+	dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_BOOL,
+					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
 
 	/* UpdateDetail */
 	dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING,
@@ -2451,7 +2467,7 @@ pk_client_init (PkClient *client)
 				     G_CALLBACK (pk_client_repo_signature_required_cb), client, NULL);
 
 	dbus_g_proxy_add_signal (proxy, "RepoDetail",
-				 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
+				 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
 	dbus_g_proxy_connect_signal (proxy, "RepoDetail",
 				     G_CALLBACK (pk_client_repo_detail_cb), client, NULL);
 
diff --git a/src/pk-backend.c b/src/pk-backend.c
index f86d6a1..d640235 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -60,11 +60,15 @@ struct _PkBackendPrivate
 	PkStatusEnum		 status; /* this changes */
 	gboolean		 xcached_force;
 	gboolean		 xcached_allow_deps;
+	gboolean		 xcached_enabled;
 	gchar			*xcached_package_id;
 	gchar			*xcached_transaction_id;
 	gchar			*xcached_full_path;
 	gchar			*xcached_filter;
 	gchar			*xcached_search;
+	gchar			*xcached_repo_id;
+	gchar			*xcached_parameter;
+	gchar			*xcached_value;
 	PkExitEnum		 exit;
 	GTimer			*timer;
 	PkSpawn			*spawn;
@@ -1093,6 +1097,13 @@ pk_backend_set_running (PkBackend *backend)
 		backend->desc->update_system (backend);
 	} else if (backend->priv->role == PK_ROLE_ENUM_GET_REPO_LIST) {
 		backend->desc->get_repo_list (backend);
+	} else if (backend->priv->role == PK_ROLE_ENUM_REPO_ENABLE) {
+		backend->desc->repo_enable (backend, backend->priv->xcached_repo_id,
+					    backend->priv->xcached_enabled);
+	} else if (backend->priv->role == PK_ROLE_ENUM_REPO_SET_DATA) {
+		backend->desc->repo_set_data (backend, backend->priv->xcached_repo_id,
+					      backend->priv->xcached_parameter,
+					      backend->priv->xcached_value);
 	} else {
 		return FALSE;
 	}
@@ -1418,9 +1429,9 @@ pk_backend_repo_enable (PkBackend *backend, const gchar	*repo_id, gboolean enabl
 		pk_backend_not_implemented_yet (backend, "RepoEnable");
 		return FALSE;
 	}
+	backend->priv->xcached_repo_id = g_strdup (repo_id);
+	backend->priv->xcached_enabled = enabled;
 	pk_backend_set_role (backend, PK_ROLE_ENUM_REPO_ENABLE);
-	/* don't queue this */
-	backend->desc->repo_enable (backend, repo_id, enabled);
 	return TRUE;
 }
 
@@ -1435,9 +1446,10 @@ pk_backend_repo_set_data (PkBackend *backend, const gchar *repo_id, const gchar
 		pk_backend_not_implemented_yet (backend, "RepoSetData");
 		return FALSE;
 	}
+	backend->priv->xcached_repo_id = g_strdup (repo_id);
+	backend->priv->xcached_parameter = g_strdup (parameter);
+	backend->priv->xcached_value = g_strdup (value);
 	pk_backend_set_role (backend, PK_ROLE_ENUM_REPO_SET_DATA);
-	/* don't queue this */
-	backend->desc->repo_set_data (backend, repo_id, parameter, value);
 	return TRUE;
 }
 
@@ -1614,6 +1626,9 @@ pk_backend_finalize (GObject *object)
 	g_free (backend->priv->xcached_transaction_id);
 	g_free (backend->priv->xcached_filter);
 	g_free (backend->priv->xcached_search);
+	g_free (backend->priv->xcached_repo_id);
+	g_free (backend->priv->xcached_parameter);
+	g_free (backend->priv->xcached_value);
 
 	if (backend->priv->spawn != NULL) {
 		pk_backend_spawn_helper_delete (backend);
@@ -1735,11 +1750,15 @@ pk_backend_init (PkBackend *backend)
 	backend->priv->during_initialize = FALSE;
 	backend->priv->spawn = NULL;
 	backend->priv->handle = NULL;
+	backend->priv->xcached_enabled = FALSE;
 	backend->priv->xcached_package_id = NULL;
 	backend->priv->xcached_transaction_id = NULL;
 	backend->priv->xcached_full_path = NULL;
 	backend->priv->xcached_filter = NULL;
 	backend->priv->xcached_search = NULL;
+	backend->priv->xcached_repo_id = NULL;
+	backend->priv->xcached_parameter = NULL;
+	backend->priv->xcached_value = NULL;
 	backend->priv->last_percentage = PK_BACKEND_PERCENTAGE_INVALID;
 	backend->priv->last_subpercentage = PK_BACKEND_PERCENTAGE_INVALID;
 	backend->priv->last_package = NULL;
diff --git a/src/pk-engine.c b/src/pk-engine.c
index b3cfe6a..d00fe52 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -612,7 +612,7 @@ pk_engine_repo_detail_cb (PkBackend *backend, const gchar *repo_id,
 	}
 
 	pk_debug ("emitting repo-detail tid:%s, %s, %s, %i", item->tid, repo_id, description, enabled);
-	g_signal_emit (engine, signals [PK_ENGINE_REPO_DETAIL], 0, repo_id, description, enabled);
+	g_signal_emit (engine, signals [PK_ENGINE_REPO_DETAIL], 0, item->tid, repo_id, description, enabled);
 }
 
 /**
@@ -1787,18 +1787,41 @@ pk_engine_get_repo_list (PkEngine *engine, const gchar *tid, GError **error)
 
 /**
  * pk_engine_repo_enable:
+ *
+ * This is async, so we have to treat it a bit carefully
  **/
 void
-pk_engine_repo_enable (PkEngine	*engine, const gchar *repo_id, gboolean enabled,
-		       DBusGMethodInvocation *context, GError **old_error)
+pk_engine_repo_enable (PkEngine *engine, const gchar *tid, const gchar *repo_id, gboolean enabled,
+		       DBusGMethodInvocation *context, GError **dead_error)
 {
+#if 0
+xxx	has to be done when finished!
+	/* this has to be done as different repos might have different updates */
+	if (engine->priv->updates_cache != NULL) {
+		pk_debug ("unreffing updates cache as we have just enabled/disabled a repo");
+		g_object_unref (engine->priv->updates_cache);
+		engine->priv->updates_cache = NULL;
+	}
+		/* this should cause the client program to requeue an update */
+		pk_debug ("emitting updates-changed tid: %s", tid);
+		g_signal_emit (engine, signals [PK_ENGINE_UPDATES_CHANGED], 0, tid);
+#endif
 	gboolean ret;
+	PkTransactionItem *item;
 	GError *error;
-	PkBackend *backend;
 
 	g_return_if_fail (engine != NULL);
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
+	/* find pre-requested transaction id */
+	item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
+	if (item == NULL) {
+		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
+				     "transaction_id '%s' not found", tid);
+		dbus_g_method_return_error (context, error);
+		return;
+	}
+
 	/* check with PolicyKit if the action is allowed from this client - if not, set an error */
 	ret = pk_engine_action_is_allowed (engine, context, "org.freedesktop.packagekit.repo-change", &error);
 	if (ret == FALSE) {
@@ -1807,51 +1830,52 @@ pk_engine_repo_enable (PkEngine	*engine, const gchar *repo_id, gboolean enabled,
 	}
 
 	/* create a new backend */
-	backend = pk_engine_new_backend (engine);
-	if (backend == NULL) {
+	item->backend = pk_engine_new_backend (engine);
+	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Operation not yet supported by backend");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
 
-	/* this has to be done as different repos might have different updates */
-	if (engine->priv->updates_cache != NULL) {
-		pk_debug ("unreffing updates cache as we have just enabled/disabled a repo");
-		g_object_unref (engine->priv->updates_cache);
-		engine->priv->updates_cache = NULL;
-	}
-
-	ret = pk_backend_repo_enable (backend, repo_id, enabled);
-	g_object_unref (backend);
-	if (ret == TRUE) {
-		/* this should cause the client program to requeue an update */
-		pk_debug ("emitting updates-changed tid:(null)");
-		g_signal_emit (engine, signals [PK_ENGINE_UPDATES_CHANGED], 0, NULL);
-	} else {
+	ret = pk_backend_repo_enable (item->backend, repo_id, enabled);
+	if (ret == FALSE) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Operation not yet supported by backend");
+		pk_engine_item_delete (engine, item);
 		dbus_g_method_return_error (context, error);
 		return;
 	}
+	pk_engine_item_add (engine, item);
 	dbus_g_method_return (context);
 }
 
 /**
  * pk_engine_repo_set_data:
+ *
+ * This is async, so we have to treat it a bit carefully
  **/
 void
-pk_engine_repo_set_data (PkEngine *engine, const gchar *repo_id,
+pk_engine_repo_set_data (PkEngine *engine, const gchar *tid, const gchar *repo_id,
 			 const gchar *parameter, const gchar *value,
-			 DBusGMethodInvocation *context, GError **old_error)
+		         DBusGMethodInvocation *context, GError **dead_error)
 {
 	gboolean ret;
+	PkTransactionItem *item;
 	GError *error;
-	PkBackend *backend;
 
 	g_return_if_fail (engine != NULL);
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
+	/* find pre-requested transaction id */
+	item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
+	if (item == NULL) {
+		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
+				     "transaction_id '%s' not found", tid);
+		dbus_g_method_return_error (context, error);
+		return;
+	}
+
 	/* check with PolicyKit if the action is allowed from this client - if not, set an error */
 	ret = pk_engine_action_is_allowed (engine, context, "org.freedesktop.packagekit.repo-change", &error);
 	if (ret == FALSE) {
@@ -1860,22 +1884,23 @@ pk_engine_repo_set_data (PkEngine *engine, const gchar *repo_id,
 	}
 
 	/* create a new backend */
-	backend = pk_engine_new_backend (engine);
-	if (backend == NULL) {
+	item->backend = pk_engine_new_backend (engine);
+	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Operation not yet supported by backend");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
 
-	ret = pk_backend_repo_set_data (backend, repo_id, parameter, value);
-	g_object_unref (backend);
+	ret = pk_backend_repo_set_data (item->backend, repo_id, parameter, value);
 	if (ret == FALSE) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Operation not yet supported by backend");
+		pk_engine_item_delete (engine, item);
 		dbus_g_method_return_error (context, error);
 		return;
 	}
+	pk_engine_item_add (engine, item);
 	dbus_g_method_return (context);
 }
 
diff --git a/src/pk-engine.h b/src/pk-engine.h
index b235a39..06f1af1 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -210,11 +210,13 @@ gboolean	 pk_engine_get_repo_list		(PkEngine	*engine,
 							 const gchar	*tid,
 							 GError		**error);
 void		 pk_engine_repo_enable			(PkEngine	*engine,
+							 const gchar	*tid,
 							 const gchar	*repo_id,
 							 gboolean	 enabled,
 							 DBusGMethodInvocation *context,
 							 GError		**error);
 void		 pk_engine_repo_set_data		(PkEngine	*engine,
+							 const gchar	*tid,
 							 const gchar	*repo_id,
 							 const gchar	*parameter,
 							 const gchar	*value,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 9782057..f517537 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -167,10 +167,14 @@
       <arg type="s" name="tid" direction="in"/>
     </method>
     <method name="RepoEnable">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg type="s" name="tid" direction="in"/>
       <arg type="s" name="repo_id" direction="in"/>
       <arg type="b" name="enabled" direction="in"/>
     </method>
     <method name="RepoSetData">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg type="s" name="tid" direction="in"/>
       <arg type="s" name="repo_id" direction="in"/>
       <arg type="s" name="parameter" direction="in"/>
       <arg type="s" name="value" direction="in"/>
commit 3f1ce8012f412b75f25c1127e5b186a49e6c333a
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 11:12:03 2007 +0100

    Add methods and callbacks in pkcon for repo stuff

diff --git a/TODO b/TODO
index 2e02fc3..0d7f8f3 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,10 @@ Order of no particular importance:
 TimeRemaining()
 
 *** the backends will have repo controls ***
-Add methods and callbacks in pkcon for repo stuff
+Add the extra operations in the backend status widget
+Connect up pk-repo to actually get the data
+If pk-repo can't get repos, then display a message and quit
+If repos can't be enabled then grey out check boxes
 
 *** Prepare download to refresh system ***
 Either use a flag or a new method. I'm not sure which yet.
diff --git a/client/pk-console.c b/client/pk-console.c
index c7cc842..5a0f008 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -133,6 +133,17 @@ pk_console_update_detail_cb (PkClient *client, const gchar *package_id,
 }
 
 /**
+ * pk_console_repo_detail_cb:
+ **/
+static void
+pk_console_repo_detail_cb (PkClient *client, const gchar *repo_id,
+			   const gchar *description, gboolean enabled, gpointer data)
+{
+	g_print ("[%s]\n", repo_id);
+	g_print ("  %i, %s\n", enabled, description);
+}
+
+/**
  * pk_console_percentage_changed_cb:
  **/
 static void
@@ -168,6 +179,9 @@ pk_console_usage (const gchar *error)
 	g_print ("  pkcon [verbose] get groups\n");
 	g_print ("  pkcon [verbose] get filters\n");
 	g_print ("  pkcon [verbose] get transactions\n");
+	g_print ("  pkcon [verbose] get repos\n");
+	g_print ("  pkcon [verbose] enable-repo <repo_id>\n");
+	g_print ("  pkcon [verbose] disable-repo <repo_id>\n");
 	g_print ("\n");
 	g_print ("    package_id is typically gimp;2:2.4.0-0.rc1.1.fc8;i386;development\n");
 }
@@ -289,10 +303,28 @@ pk_console_parse_multiple_commands (PkClient *client, GPtrArray *array)
 			remove = 1;
 			goto out;
 		} else {
-			pk_warning ("TODO!");
+			pk_client_resolve (client, value);
 			pk_client_wait ();
 			remove = 2;
 		}
+	} else if (strcmp (mode, "enable-repo") == 0) {
+		if (value == NULL) {
+			pk_console_usage ("you need to specify a repo name");
+			remove = 1;
+			goto out;
+		} else {
+			pk_client_repo_enable (client, value, TRUE);
+			remove = 2;
+		}
+	} else if (strcmp (mode, "disable-repo") == 0) {
+		if (value == NULL) {
+			pk_console_usage ("you need to specify a repo name");
+			remove = 1;
+			goto out;
+		} else {
+			pk_client_repo_enable (client, value, FALSE);
+			remove = 2;
+		}
 	} else if (strcmp (mode, "get") == 0) {
 		if (value == NULL) {
 			pk_console_usage ("you need to specify a get type");
@@ -352,6 +384,10 @@ pk_console_parse_multiple_commands (PkClient *client, GPtrArray *array)
 			pk_enum_list_print (elist);
 			g_object_unref (elist);
 			remove = 2;
+		} else if (strcmp (value, "repos") == 0) {
+			pk_client_get_repo_list (client);
+			pk_client_wait ();
+			remove = 2;
 		} else if (strcmp (value, "groups") == 0) {
 			elist = pk_client_get_groups (client);
 			pk_enum_list_print (elist);
@@ -491,6 +527,8 @@ main (int argc, char *argv[])
 			  G_CALLBACK (pk_console_repo_signature_required_cb), NULL);
 	g_signal_connect (client, "update-detail",
 			  G_CALLBACK (pk_console_update_detail_cb), NULL);
+	g_signal_connect (client, "repo-detail",
+			  G_CALLBACK (pk_console_repo_detail_cb), NULL);
 	g_signal_connect (client, "percentage-changed",
 			  G_CALLBACK (pk_console_percentage_changed_cb), NULL);
 	g_signal_connect (client, "finished",
commit 2a1b7674fef5b287e653da90db9e46c834cd6abb
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 10:58:34 2007 +0100

    emit task-list-changed when the dameon connects or disconnects to clean up a crashing daemon

diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index 88ac84f..43829b7 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -39,6 +39,7 @@
 #include "pk-common.h"
 #include "pk-task-list.h"
 #include "pk-job-list.h"
+#include "pk-connection.h"
 
 static void     pk_task_list_class_init		(PkTaskListClass *klass);
 static void     pk_task_list_init		(PkTaskList      *task_list);
@@ -48,6 +49,7 @@ static void     pk_task_list_finalize		(GObject         *object);
 
 struct PkTaskListPrivate
 {
+	PkConnection		*pconnection;
 	GPtrArray		*task_list;
 	PkJobList		*job_list;
 };
@@ -291,6 +293,19 @@ pk_task_list_transaction_list_changed_cb (PkJobList *jlist, PkTaskList *tlist)
 }
 
 /**
+ * pk_connection_changed_cb:
+ **/
+static void
+pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkTaskList *tlist)
+{
+	pk_debug ("connected=%i", connected);
+
+	/* if we crashed, then loose all the items in the task list */
+	pk_debug ("emit task-list-changed");
+	g_signal_emit (tlist , signals [PK_TASK_LIST_CHANGED], 0);
+}
+
+/**
  * pk_task_list_class_init:
  **/
 static void
@@ -332,6 +347,11 @@ pk_task_list_init (PkTaskList *tlist)
 	g_signal_connect (tlist->priv->job_list, "transaction-list-changed",
 			  G_CALLBACK (pk_task_list_transaction_list_changed_cb), tlist);
 
+	/* watch for PackageKit on the bus, and try to connect up at start */
+	tlist->priv->pconnection = pk_connection_new ();
+	g_signal_connect (tlist->priv->pconnection, "connection-changed",
+			  G_CALLBACK (pk_connection_changed_cb), tlist);
+
 	/* we maintain a local copy */
 	tlist->priv->task_list = g_ptr_array_new ();
 
@@ -366,6 +386,7 @@ pk_task_list_finalize (GObject *object)
 
 	g_ptr_array_free (tlist->priv->task_list, TRUE);
 	g_object_unref (tlist->priv->job_list);
+	g_object_unref (tlist->priv->pconnection);
 
 	G_OBJECT_CLASS (pk_task_list_parent_class)->finalize (object);
 }
commit 99a813cf8c0a4a1254a6d4d7974a8b7405d672ee
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 10:31:35 2007 +0100

    add the client side bits for the repo functionality

diff --git a/TODO b/TODO
index 77727b8..2e02fc3 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,7 @@ Order of no particular importance:
 TimeRemaining()
 
 *** the backends will have repo controls ***
-Add methods and signals to the client library
+Add methods and callbacks in pkcon for repo stuff
 
 *** Prepare download to refresh system ***
 Either use a flag or a new method. I'm not sure which yet.
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index a5ef61d..ebdb966 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -84,6 +84,7 @@ typedef enum {
 	PK_CLIENT_TRANSACTION_STATUS_CHANGED,
 	PK_CLIENT_UPDATE_DETAIL,
 	PK_CLIENT_REPO_SIGNATURE_REQUIRED,
+	PK_CLIENT_REPO_DETAIL,
 	PK_CLIENT_LOCKED,
 	PK_CLIENT_LAST_SIGNAL
 } PkSignals;
@@ -502,7 +503,7 @@ pk_client_repo_signature_required_cb (DBusGProxy *proxy, const gchar *tid, const
 {
 	g_return_if_fail (client != NULL);
 	g_return_if_fail (PK_IS_CLIENT (client));
-	
+
 	/* check to see if we have been assigned yet */
 	if (client->priv->tid == NULL) {
 		pk_debug ("ignoring tid:%s as we are not yet assigned", tid);
@@ -518,6 +519,28 @@ pk_client_repo_signature_required_cb (DBusGProxy *proxy, const gchar *tid, const
 }
 
 /**
+ * pk_client_repo_detail_cb:
+ **/
+static void
+pk_client_repo_detail_cb (DBusGProxy *proxy, const gchar *tid, const gchar *repo_id,
+			  const gchar *description, gboolean enabled, PkClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (PK_IS_CLIENT (client));
+
+	/* check to see if we have been assigned yet */
+	if (client->priv->tid == NULL) {
+		pk_debug ("ignoring tid:%s as we are not yet assigned", tid);
+		return;
+	}
+
+	if (pk_transaction_id_equal (tid, client->priv->tid) == TRUE) {
+		pk_debug ("emit repo-detail %s, %s, %i", repo_id, description, enabled);
+		g_signal_emit (client, signals [PK_CLIENT_REPO_DETAIL], 0, repo_id, description, enabled);
+	}
+}
+
+/**
  * pk_client_error_code_cb:
  */
 static void
@@ -1735,11 +1758,180 @@ pk_client_install_file (PkClient *client, const gchar *file)
 	return ret;
 }
 
+/**
+ * pk_client_get_repo_list:
+ */
+gboolean
+pk_client_get_repo_list (PkClient *client)
+{
+	gboolean ret;
+	GError *error;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+	/* check to see if we already have a transaction */
+	ret = pk_client_allocate_transaction_id (client);
+	if (ret == FALSE) {
+		pk_warning ("Failed to get transaction ID");
+		return FALSE;
+	}
+	/* save this so we can re-issue it */
+	client->priv->role = PK_ROLE_ENUM_GET_REPO_LIST;
+
+	error = NULL;
+	ret = dbus_g_proxy_call (client->priv->proxy, "GetRepoList", &error,
+				 G_TYPE_STRING, client->priv->tid,
+				 G_TYPE_INVALID,
+				 G_TYPE_INVALID);
+	if (error != NULL) {
+		const gchar *error_name;
+		error_name = pk_client_get_error_name (error);
+		pk_debug ("ERROR: %s: %s", error_name, error->message);
+		g_error_free (error);
+	}
+	if (ret == FALSE) {
+		/* abort as the DBUS method failed */
+		pk_warning ("GetRepoList failed!");
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
 /******************************************************************************
  *                    NON-TRANSACTION ID METHODS
  ******************************************************************************/
 
 /**
+ * pk_client_repo_enable_action:
+ **/
+gboolean
+pk_client_repo_enable_action (PkClient *client, const gchar *repo_id, gboolean enabled, GError **error)
+{
+	gboolean ret;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+	*error = NULL;
+	ret = dbus_g_proxy_call (client->priv->proxy, "RepoEnable", error,
+				 G_TYPE_STRING, repo_id,
+				 G_TYPE_BOOLEAN, enabled,
+				 G_TYPE_INVALID,
+				 G_TYPE_INVALID);
+	if (ret == FALSE) {
+		/* abort as the DBUS method failed */
+		pk_warning ("RepoEnable failed!");
+		return FALSE;
+	}
+	return TRUE;
+}
+
+/**
+ * pk_client_repo_enable:
+ */
+gboolean
+pk_client_repo_enable (PkClient *client, const gchar *repo_id, gboolean enabled)
+{
+	gboolean ret;
+	GError *error;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+	/* save this so we can re-issue it */
+	client->priv->role = PK_ROLE_ENUM_REPO_ENABLE;
+
+	/* hopefully do the operation first time */
+	ret = pk_client_repo_enable_action (client, repo_id, enabled, &error);
+
+	/* we were refused by policy then try to get auth */
+	if (ret == FALSE) {
+		if (pk_polkit_client_error_denied_by_policy (error) == TRUE) {
+			/* retry the action if we succeeded */
+			if (pk_polkit_client_gain_privilege_str (client->priv->polkit, error->message) == TRUE) {
+				pk_debug ("gained priv");
+				g_error_free (error);
+				/* do it all over again */
+				ret = pk_client_repo_enable_action (client, repo_id, enabled, &error);
+			}
+		}
+		if (error != NULL) {
+			pk_debug ("ERROR: %s", error->message);
+			g_error_free (error);
+		}
+	}
+
+	return ret;
+}
+
+/**
+ * pk_client_repo_set_data_action:
+ **/
+gboolean
+pk_client_repo_set_data_action (PkClient *client, const gchar *repo_id,
+				const gchar *parameter, const gchar *value, GError **error)
+{
+	gboolean ret;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+	*error = NULL;
+	ret = dbus_g_proxy_call (client->priv->proxy, "RepoSetData", error,
+				 G_TYPE_STRING, repo_id,
+				 G_TYPE_STRING, parameter,
+				 G_TYPE_STRING, value,
+				 G_TYPE_INVALID,
+				 G_TYPE_INVALID);
+	if (ret == FALSE) {
+		/* abort as the DBUS method failed */
+		pk_warning ("RepoSetData failed!");
+		return FALSE;
+	}
+	return TRUE;
+}
+
+/**
+ * pk_client_repo_set_data:
+ */
+gboolean
+pk_client_repo_set_data (PkClient *client, const gchar *repo_id, const gchar *parameter, const gchar *value)
+{
+	gboolean ret;
+	GError *error;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+	/* save this so we can re-issue it */
+	client->priv->role = PK_ROLE_ENUM_REPO_SET_DATA;
+
+	/* hopefully do the operation first time */
+	ret = pk_client_repo_set_data_action (client, repo_id, parameter, value, &error);
+
+	/* we were refused by policy then try to get auth */
+	if (ret == FALSE) {
+		if (pk_polkit_client_error_denied_by_policy (error) == TRUE) {
+			/* retry the action if we succeeded */
+			if (pk_polkit_client_gain_privilege_str (client->priv->polkit, error->message) == TRUE) {
+				pk_debug ("gained priv");
+				g_error_free (error);
+				/* do it all over again */
+				ret = pk_client_repo_set_data_action (client, repo_id, parameter, value, &error);
+			}
+		}
+		if (error != NULL) {
+			pk_debug ("ERROR: %s", error->message);
+			g_error_free (error);
+		}
+	}
+
+	return ret;
+}
+
+/**
  * pk_client_get_actions:
  **/
 PkEnumList *
@@ -2051,6 +2243,11 @@ pk_client_class_init (PkClientClass *klass)
 			      0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_UINT,
 			      G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
 			      G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT);
+	signals [PK_CLIENT_REPO_DETAIL] =
+		g_signal_new ("repo-detail",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      0, NULL, NULL, pk_marshal_VOID__STRING_STRING_BOOLEAN,
+			      G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
 	signals [PK_CLIENT_ERROR_CODE] =
 		g_signal_new ("error-code",
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -2179,6 +2376,10 @@ pk_client_init (PkClient *client)
 	dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING,
 					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
 
+	/* RepoDetail */
+	dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_BOOL,
+					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
+
 	/* UpdateDetail */
 	dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING,
 					   G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
@@ -2249,6 +2450,11 @@ pk_client_init (PkClient *client)
 	dbus_g_proxy_connect_signal (proxy, "RepoSignatureRequired",
 				     G_CALLBACK (pk_client_repo_signature_required_cb), client, NULL);
 
+	dbus_g_proxy_add_signal (proxy, "RepoDetail",
+				 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
+	dbus_g_proxy_connect_signal (proxy, "RepoDetail",
+				     G_CALLBACK (pk_client_repo_detail_cb), client, NULL);
+
 	dbus_g_proxy_add_signal (proxy, "ErrorCode",
 				 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
 	dbus_g_proxy_connect_signal (proxy, "ErrorCode",
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index dc57f77..f0b7473 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -115,6 +115,16 @@ gboolean	 pk_client_rollback			(PkClient	*client,
 gboolean	 pk_client_cancel			(PkClient	*client);
 gboolean	 pk_client_requeue			(PkClient	*client);
 
+/* repo stuff */
+gboolean	 pk_client_get_repo_list		(PkClient	*client);
+gboolean	 pk_client_repo_enable			(PkClient	*client,
+							 const gchar	*repo_id,
+							 gboolean	 enabled);
+gboolean	 pk_client_repo_set_data		(PkClient	*client,
+							 const gchar	*repo_id,
+							 const gchar	*parameter,
+							 const gchar	*value);
+
 /* cached stuff */
 GPtrArray	*pk_client_get_package_buffer		(PkClient	*client);
 PkRestartEnum	 pk_client_get_require_restart		(PkClient	*client);
commit 6187e9062e14ef2305994eef29a3f625939da206
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 10:05:40 2007 +0100

    Add the callback and methods in PkBackend for the repo stuff

diff --git a/TODO b/TODO
index aba873c..77727b8 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ Order of no particular importance:
 TimeRemaining()
 
 *** the backends will have repo controls ***
-Add the callback and methods in PkBackend
 Add methods and signals to the client library
 
 *** Prepare download to refresh system ***
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 7ab4f86..f86d6a1 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -99,6 +99,7 @@ enum {
 	PK_BACKEND_CHANGE_TRANSACTION_DATA,
 	PK_BACKEND_FINISHED,
 	PK_BACKEND_ALLOW_INTERRUPT,
+	PK_BACKEND_REPO_DETAIL,
 	PK_BACKEND_LAST_SIGNAL
 };
 
@@ -952,7 +953,7 @@ pk_backend_repo_detail (PkBackend *backend, const gchar *repo_id,
 	g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
 
 	pk_debug ("emit repo-detail %s, %s, %i", repo_id, description, enabled);
-//	g_signal_emit (backend, signals [PK_BACKEND_REPO_DETAIL], 0, repo_id, description, enabled);
+	g_signal_emit (backend, signals [PK_BACKEND_REPO_DETAIL], 0, repo_id, description, enabled);
 	return TRUE;
 }
 
@@ -1090,6 +1091,8 @@ pk_backend_set_running (PkBackend *backend)
 					       backend->priv->xcached_package_id);
 	} else if (backend->priv->role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
 		backend->desc->update_system (backend);
+	} else if (backend->priv->role == PK_ROLE_ENUM_GET_REPO_LIST) {
+		backend->desc->get_repo_list (backend);
 	} else {
 		return FALSE;
 	}
@@ -1390,6 +1393,55 @@ pk_backend_update_system (PkBackend *backend)
 }
 
 /**
+ * pk_backend_get_repo_list:
+ */
+gboolean
+pk_backend_get_repo_list (PkBackend *backend)
+{
+	g_return_val_if_fail (backend != NULL, FALSE);
+	if (backend->desc->get_repo_list == NULL) {
+		pk_backend_not_implemented_yet (backend, "GetRepoList");
+		return FALSE;
+	}
+	pk_backend_set_role (backend, PK_ROLE_ENUM_GET_REPO_LIST);
+	return TRUE;
+}
+
+/**
+ * pk_backend_repo_enable:
+ */
+gboolean
+pk_backend_repo_enable (PkBackend *backend, const gchar	*repo_id, gboolean enabled)
+{
+	g_return_val_if_fail (backend != NULL, FALSE);
+	if (backend->desc->repo_enable == NULL) {
+		pk_backend_not_implemented_yet (backend, "RepoEnable");
+		return FALSE;
+	}
+	pk_backend_set_role (backend, PK_ROLE_ENUM_REPO_ENABLE);
+	/* don't queue this */
+	backend->desc->repo_enable (backend, repo_id, enabled);
+	return TRUE;
+}
+
+/**
+ * pk_backend_repo_set_data:
+ */
+gboolean
+pk_backend_repo_set_data (PkBackend *backend, const gchar *repo_id, const gchar *parameter, const gchar *value)
+{
+	g_return_val_if_fail (backend != NULL, FALSE);
+	if (backend->desc->repo_set_data == NULL) {
+		pk_backend_not_implemented_yet (backend, "RepoSetData");
+		return FALSE;
+	}
+	pk_backend_set_role (backend, PK_ROLE_ENUM_REPO_SET_DATA);
+	/* don't queue this */
+	backend->desc->repo_set_data (backend, repo_id, parameter, value);
+	return TRUE;
+}
+
+/**
  * pk_backend_get_backend_detail:
  */
 gboolean
@@ -1470,6 +1522,15 @@ pk_backend_get_actions (PkBackend *backend)
 	if (backend->desc->update_system != NULL) {
 		pk_enum_list_append (elist, PK_ROLE_ENUM_UPDATE_SYSTEM);
 	}
+	if (backend->desc->get_repo_list != NULL) {
+		pk_enum_list_append (elist, PK_ROLE_ENUM_GET_REPO_LIST);
+	}
+	if (backend->desc->repo_enable != NULL) {
+		pk_enum_list_append (elist, PK_ROLE_ENUM_REPO_ENABLE);
+	}
+	if (backend->desc->repo_set_data != NULL) {
+		pk_enum_list_append (elist, PK_ROLE_ENUM_REPO_SET_DATA);
+	}
 	return elist;
 }
 
@@ -1651,6 +1712,11 @@ pk_backend_class_init (PkBackendClass *klass)
 			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
 			      0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
 			      G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+	signals [PK_BACKEND_REPO_DETAIL] =
+		g_signal_new ("repo-detail",
+			      G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+			      0, NULL, NULL, pk_marshal_VOID__STRING_STRING_BOOL,
+			      G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
 
 	g_type_class_add_private (klass, sizeof (PkBackendPrivate));
 }
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 8a51269..0fd17da 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -98,6 +98,16 @@ gboolean	 pk_backend_thread_helper		(PkBackend	*backend,
 							 PkBackendThreadFunc func,
 							 gpointer	 data);
 
+/* repo stuff */
+gboolean	 pk_backend_get_repo_list		(PkBackend	*backend);
+gboolean	 pk_backend_repo_enable			(PkBackend	*backend,
+							 const gchar	*repo_id,
+							 gboolean	 enabled);
+gboolean	 pk_backend_repo_set_data		(PkBackend	*backend,
+							 const gchar	*repo_id,
+							 const gchar	*parameter,
+							 const gchar	*value);
+
 /**
  * PkBackendDesc:
  */
@@ -129,8 +139,8 @@ struct _PkBackendDesc {
 	void		(*update_system)	(PkBackend *backend);
 	/* repo stuff */
 	void		(*get_repo_list)	(PkBackend *backend);
-	void		(*repo_enable)		(PkBackend *backend, const gchar *rid, gboolean enabled);
-	void		(*repo_set_data)	(PkBackend *backend, const gchar *rid, const gchar *parameter, const gchar *value);
+	void		(*repo_enable)		(PkBackend *backend, const gchar *repo_id, gboolean enabled);
+	void		(*repo_set_data)	(PkBackend *backend, const gchar *repo_id, const gchar *parameter, const gchar *value);
 	gpointer	padding[12];
 };
 
diff --git a/src/pk-engine.c b/src/pk-engine.c
index d603ec9..b3cfe6a 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -594,6 +594,28 @@ pk_engine_change_transaction_data_cb (PkBackend *backend, gchar *data, PkEngine
 }
 
 /**
+ * pk_engine_repo_detail_cb:
+ **/
+static void
+pk_engine_repo_detail_cb (PkBackend *backend, const gchar *repo_id,
+			  const gchar *description, gboolean enabled, 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;
+	}
+
+	pk_debug ("emitting repo-detail tid:%s, %s, %s, %i", item->tid, repo_id, description, enabled);
+	g_signal_emit (engine, signals [PK_ENGINE_REPO_DETAIL], 0, repo_id, description, enabled);
+}
+
+/**
  * pk_engine_new_backend:
  **/
 static PkBackend *
@@ -643,6 +665,8 @@ pk_engine_new_backend (PkEngine *engine)
 			  G_CALLBACK (pk_engine_allow_interrupt_cb), engine);
 	g_signal_connect (backend, "change-transaction-data",
 			  G_CALLBACK (pk_engine_change_transaction_data_cb), engine);
+	g_signal_connect (backend, "repo-detail",
+			  G_CALLBACK (pk_engine_repo_detail_cb), engine);
 
 	/* initialise some stuff */
 	pk_engine_reset_timer (engine);
@@ -1750,8 +1774,7 @@ pk_engine_get_repo_list (PkEngine *engine, const gchar *tid, GError **error)
 		return FALSE;
 	}
 
-	//ret = pk_backend_get_repo_list (item->backend);
-	ret = FALSE;
+	ret = pk_backend_get_repo_list (item->backend);
 	if (ret == FALSE) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 			     "Operation not yet supported by backend");
@@ -1799,8 +1822,8 @@ pk_engine_repo_enable (PkEngine	*engine, const gchar *repo_id, gboolean enabled,
 		engine->priv->updates_cache = NULL;
 	}
 
-	//ret = pk_backend_repo_enable (item->backend, repo_id, enabled);
-	ret = FALSE;
+	ret = pk_backend_repo_enable (backend, repo_id, enabled);
+	g_object_unref (backend);
 	if (ret == TRUE) {
 		/* this should cause the client program to requeue an update */
 		pk_debug ("emitting updates-changed tid:(null)");
@@ -1845,8 +1868,8 @@ pk_engine_repo_set_data (PkEngine *engine, const gchar *repo_id,
 		return;
 	}
 
-	//ret = pk_backend_repo_set_data (item->backend, repo_id, parameter, value);
-	ret = FALSE;
+	ret = pk_backend_repo_set_data (backend, repo_id, parameter, value);
+	g_object_unref (backend);
 	if (ret == FALSE) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Operation not yet supported by backend");
diff --git a/src/pk-marshal.list b/src/pk-marshal.list
index 45d2cd8..c8470c3 100644
--- a/src/pk-marshal.list
+++ b/src/pk-marshal.list
@@ -17,6 +17,7 @@ VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING
 VOID:STRING,STRING,UINT,STRING,STRING,UINT64,STRING
 VOID:STRING,STRING,STRING,STRING,STRING,STRING,UINT64,STRING
 VOID:STRING,STRING,STRING,STRING,STRING,STRING,UINT
+VOID:STRING,STRING,BOOL
 VOID:STRING,STRING,STRING,BOOL
 VOID:STRING,UINT,STRING,STRING
 VOID:STRING,STRING,UINT,UINT,UINT



More information about the PackageKit mailing list