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

Richard Hughes hughsient at kemper.freedesktop.org
Thu May 1 06:37:04 PDT 2008


 backends/opkg/pk-backend-opkg.c     |  103 ++++-------
 backends/poldek/pk-backend-poldek.c |  120 ++++++++-----
 backends/yum/helpers/yumBackend.py  |    5 
 backends/zypp/pk-backend-zypp.cpp   |    2 
 docs/html/pk-help.html              |   31 +++
 libpackagekit/pk-network-dummy.c    |   16 +
 libpackagekit/pk-network-nm.c       |   13 +
 libpackagekit/pk-network.h          |    1 
 src/Makefile.am                     |    5 
 src/pk-backend-dbus.c               |    1 
 src/pk-backend-spawn.c              |    1 
 src/pk-backend-thread.c             |  302 ----------------------------------
 src/pk-backend-thread.h             |   66 -------
 src/pk-self-test.c                  |    4 
 src/pk-thread-list.c                |  314 ------------------------------------
 src/pk-thread-list.h                |   63 -------
 16 files changed, 175 insertions(+), 872 deletions(-)

New commits:
commit 1b73f40c94ea4eb0598b60ab24b0b032dda7bb03
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu May 1 14:35:47 2008 +0100

    remove some unused code

diff --git a/src/Makefile.am b/src/Makefile.am
index 0406be6..bd34af6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,6 @@ pkbackendincludedir=$(includedir)/packagekit-backend
 pkbackendinclude_HEADERS =				\
 	pk-backend.h					\
 	pk-backend-spawn.h				\
-	pk-backend-thread.h				\
 	$(NULL)
 
 shared_SOURCES =					\
@@ -64,12 +63,8 @@ shared_SOURCES =					\
 	pk-engine.c					\
 	pk-inhibit.h					\
 	pk-inhibit.c					\
-	pk-thread-list.h				\
-	pk-thread-list.c				\
 	pk-backend-spawn.h				\
 	pk-backend-spawn.c				\
-	pk-backend-thread.h				\
-	pk-backend-thread.c				\
 	pk-backend-dbus.h				\
 	pk-backend-dbus.c				\
 	pk-transaction-db.h				\
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index ce41d83..9bdb699 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -54,7 +54,6 @@
 #include "pk-enum.h"
 #include "pk-time.h"
 #include "pk-inhibit.h"
-#include "pk-thread-list.h"
 
 #define PK_BACKEND_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_BACKEND_DBUS, PkBackendDbusPrivate))
 
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index d77a830..9896948 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -54,7 +54,6 @@
 #include "pk-spawn.h"
 #include "pk-time.h"
 #include "pk-inhibit.h"
-#include "pk-thread-list.h"
 
 #define PK_BACKEND_SPAWN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_BACKEND_SPAWN, PkBackendSpawnPrivate))
 #define PK_BACKEND_SPAWN_PERCENTAGE_INVALID	101
diff --git a/src/pk-backend-thread.c b/src/pk-backend-thread.c
deleted file mode 100644
index 3f45ab8..0000000
--- a/src/pk-backend-thread.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007-2008 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <errno.h>
-
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#include <glib/gi18n.h>
-#include <glib/gprintf.h>
-
-#include <gmodule.h>
-#include <libgbus.h>
-
-#include <pk-common.h>
-#include <pk-package-id.h>
-#include <pk-enum.h>
-#include <pk-network.h>
-
-#include "pk-debug.h"
-#include "pk-backend-thread.h"
-#include "pk-marshal.h"
-#include "pk-enum.h"
-#include "pk-spawn.h"
-#include "pk-time.h"
-#include "pk-inhibit.h"
-#include "pk-thread-list.h"
-
-#define PK_BACKEND_THREAD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_BACKEND_THREAD, PkBackendThreadPrivate))
-
-struct PkBackendThreadPrivate
-{
-	PkThreadList		*thread_list;
-	PkBackend		*backend;
-};
-
-G_DEFINE_TYPE (PkBackendThread, pk_backend_thread, G_TYPE_OBJECT)
-
-/**
- * pk_backend_thread_create_old:
- **/
-gboolean
-pk_backend_thread_create_old (PkBackendThread *backend_thread, PkBackendThreadFuncOld func, gpointer data)
-{
-	g_return_val_if_fail (PK_IS_BACKEND_THREAD (backend_thread), FALSE);
-	pk_warning ("*** DO NOT USE THIS FUNCTION *** - use pk_backend_thread_create() instead ***");
-	return pk_thread_list_create (backend_thread->priv->thread_list, (PkThreadFunc) func, backend_thread, data);
-}
-
-/**
- * pk_backend_thread_get_backend:
- * Convenience function.
- **/
-PkBackend *
-pk_backend_thread_get_backend (PkBackendThread *backend_thread)
-{
-	g_return_val_if_fail (PK_IS_BACKEND_THREAD (backend_thread), NULL);
-	return backend_thread->priv->backend;
-}
-
-/**
- * pk_backend_thread_finalize:
- **/
-static void
-pk_backend_thread_finalize (GObject *object)
-{
-	PkBackendThread *backend_thread;
-	g_return_if_fail (PK_IS_BACKEND_THREAD (object));
-
-	backend_thread = PK_BACKEND_THREAD (object);
-
-	g_object_unref (backend_thread->priv->thread_list);
-	g_object_unref (backend_thread->priv->backend);
-
-	G_OBJECT_CLASS (pk_backend_thread_parent_class)->finalize (object);
-}
-
-/**
- * pk_backend_thread_class_init:
- **/
-static void
-pk_backend_thread_class_init (PkBackendThreadClass *klass)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-	object_class->finalize = pk_backend_thread_finalize;
-	g_type_class_add_private (klass, sizeof (PkBackendThreadPrivate));
-}
-
-/**
- * pk_backend_thread_init:
- **/
-static void
-pk_backend_thread_init (PkBackendThread *backend_thread)
-{
-	backend_thread->priv = PK_BACKEND_THREAD_GET_PRIVATE (backend_thread);
-	backend_thread->priv->thread_list = pk_thread_list_new ();
-	backend_thread->priv->backend = pk_backend_new ();
-}
-
-/**
- * pk_backend_thread_new:
- **/
-PkBackendThread *
-pk_backend_thread_new (void)
-{
-	PkBackendThread *backend_thread;
-	backend_thread = g_object_new (PK_TYPE_BACKEND_THREAD, NULL);
-	return PK_BACKEND_THREAD (backend_thread);
-}
-
-/***************************************************************************
- ***                          MAKE CHECK TESTS                           ***
- ***************************************************************************/
-#ifdef PK_BUILD_TESTS
-#include <libselftest.h>
-
-static gboolean
-pk_backend_thread_test_func_true (PkBackendThread *backend_thread, gpointer data)
-{
-	PkBackend *backend;
-
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (backend_thread);
-
-	g_usleep (1000*1000);
-	pk_backend_finished (backend);
-	return TRUE;
-}
-
-static gboolean
-pk_backend_thread_test_func_false (PkBackendThread *backend_thread, gpointer data)
-{
-	PkBackend *backend;
-
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (backend_thread);
-
-	g_usleep (1000*1000);
-	pk_backend_finished (backend);
-	return FALSE;
-}
-
-static gboolean
-pk_backend_thread_test_func_immediate_false (PkBackendThread *backend_thread, gpointer data)
-{
-	PkBackend *backend;
-
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (backend_thread);
-
-	pk_backend_finished (backend);
-	return FALSE;
-}
-
-void
-libst_backend_thread (LibSelfTest *test)
-{
-	PkBackendThread *backend_thread;
-	PkBackend *backend;
-	gboolean ret;
-	guint elapsed;
-
-	if (libst_start (test, "PkBackendThread", CLASS_AUTO) == FALSE) {
-		return;
-	}
-
-	/************************************************************/
-	libst_title (test, "get an backend_thread");
-	backend_thread = pk_backend_thread_new ();
-	if (backend_thread != NULL) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "get a backend");
-	backend = pk_backend_thread_get_backend (backend_thread);
-	if (backend != NULL) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/* needed to call initialize and destroy */
-	ret = pk_backend_set_name (backend, "dummy");
-	ret = pk_backend_lock (backend);
-
-	/************************************************************/
-	libst_title (test, "wait for a thread to return true");
-	ret = pk_backend_thread_create_old (backend_thread, pk_backend_thread_test_func_true, NULL);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "wait for a thread failed");
-	}
-
-	/* wait */
-	pk_thread_list_wait (backend_thread->priv->thread_list);
-	elapsed = libst_elapsed (test);
-
-	/************************************************************/
-	libst_title (test, "did we wait the correct time?");
-	if (elapsed < 1100 && elapsed > 900) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "did not wait for thread timeout %ims", elapsed);
-	}
-
-	/* reset the backend */
-	g_object_unref (backend_thread);
-	backend_thread = pk_backend_thread_new ();
-	backend = pk_backend_thread_get_backend (backend_thread);
-
-	/* needed to call initialize and destroy */
-	ret = pk_backend_set_name (backend, "dummy");
-	ret = pk_backend_lock (backend);
-
-	/************************************************************/
-	libst_title (test, "wait for a thread to return false");
-	ret = pk_backend_thread_create_old (backend_thread, pk_backend_thread_test_func_false, NULL);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "wait for a thread failed");
-	}
-
-	/* wait */
-	pk_thread_list_wait (backend_thread->priv->thread_list);
-	elapsed = libst_elapsed (test);
-
-	/************************************************************/
-	libst_title (test, "did we wait the correct time2?");
-	if (elapsed < 1100 && elapsed > 900) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "did not wait for thread timeout %ims", elapsed);
-	}
-
-	/* reset the backend */
-	g_object_unref (backend_thread);
-	backend_thread = pk_backend_thread_new ();
-	backend = pk_backend_thread_get_backend (backend_thread);
-
-	/* needed to call initialize and destroy */
-	ret = pk_backend_set_name (backend, "dummy");
-	ret = pk_backend_lock (backend);
-
-	/************************************************************/
-	libst_title (test, "wait for a thread to return false (straight away)");
-	ret = pk_backend_thread_create_old (backend_thread, pk_backend_thread_test_func_immediate_false, NULL);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "returned false!");
-	}
-	elapsed = libst_elapsed (test);
-
-	/************************************************************/
-	libst_title (test, "did we wait the correct time2?");
-	if (elapsed < 100) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "did not wait for thread timeout2");
-	}
-
-	g_object_unref (backend_thread);
-
-	libst_end (test);
-}
-#endif
-
diff --git a/src/pk-backend-thread.h b/src/pk-backend-thread.h
deleted file mode 100644
index 204750b..0000000
--- a/src/pk-backend-thread.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007-2008 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __PK_BACKEND_THREAD_H
-#define __PK_BACKEND_THREAD_H
-
-#include <glib-object.h>
-
-#include "pk-backend-internal.h"
-#include "pk-backend-thread.h"
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_BACKEND_THREAD		(pk_backend_thread_get_type ())
-#define PK_BACKEND_THREAD(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_BACKEND_THREAD, PkBackendThread))
-#define PK_BACKEND_THREAD_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_BACKEND_THREAD, PkBackendThreadClass))
-#define PK_IS_BACKEND_THREAD(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_BACKEND_THREAD))
-#define PK_IS_BACKEND_THREAD_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_BACKEND_THREAD))
-#define PK_BACKEND_THREAD_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_BACKEND_THREAD, PkBackendThreadClass))
-
-typedef struct PkBackendThreadPrivate PkBackendThreadPrivate;
-
-typedef struct
-{
-	 GObject		 parent;
-	 PkBackendThreadPrivate	*priv;
-} PkBackendThread;
-
-typedef struct
-{
-	GObjectClass	parent_class;
-} PkBackendThreadClass;
-
-/* general */
-GType		 pk_backend_thread_get_type		(void) G_GNUC_CONST;
-PkBackendThread	*pk_backend_thread_new			(void);
-typedef gboolean (*PkBackendThreadFuncOld)		(PkBackendThread	*backend_thread,
-							 gpointer		 data);
-gboolean	 pk_backend_thread_create_old		(PkBackendThread	*backend_thread,
-							 PkBackendThreadFuncOld	 func,
-							 gpointer		 data);
-PkBackend	*pk_backend_thread_get_backend		(PkBackendThread	*backend_thread);
-
-
-G_END_DECLS
-
-#endif /* __PK_BACKEND_THREAD_H */
-
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 3573725..ce7f0a5 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -28,14 +28,12 @@
 void libst_conf (LibSelfTest *test);
 void libst_inhibit (LibSelfTest *test);
 void libst_spawn (LibSelfTest *test);
-void libst_thread_list (LibSelfTest *test);
 void libst_transaction_list (LibSelfTest *test);
 void libst_transaction_db (LibSelfTest *test);
 void libst_security (LibSelfTest *test);
 void libst_time (LibSelfTest *test);
 void libst_backend (LibSelfTest *test);
 void libst_backend_spawn (LibSelfTest *test);
-void libst_backend_thread (LibSelfTest *test);
 void libst_backend_dbus (LibSelfTest *test);
 void libst_file_monitor (LibSelfTest *test);
 void libst_engine (LibSelfTest *test);
@@ -59,14 +57,12 @@ main (int argc, char **argv)
 	libst_conf (&test);
 	libst_inhibit (&test);
 	libst_spawn (&test);
-	libst_thread_list (&test);
 	libst_transaction_list (&test);
 	libst_transaction_db (&test);
 
 	/* backend stuff */
 	libst_backend (&test);
 	libst_backend_spawn (&test);
-	libst_backend_thread (&test);
 	libst_backend_dbus (&test);
 
 	/* system */
diff --git a/src/pk-thread-list.c b/src/pk-thread-list.c
deleted file mode 100644
index e53a512..0000000
--- a/src/pk-thread-list.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <errno.h>
-#include <signal.h>
-
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#include <glib/gi18n.h>
-#include "pk-debug.h"
-#include "pk-common.h"
-#include "pk-thread-list.h"
-
-static void     pk_thread_list_class_init	(PkThreadListClass *klass);
-static void     pk_thread_list_init	(PkThreadList      *tlist);
-static void     pk_thread_list_finalize	(GObject        *object);
-
-#define PK_THREAD_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_THREAD_LIST, PkThreadListPrivate))
-#define PK_THREAD_LIST_COUNT_FILE		LOCALSTATEDIR "/run/PackageKit/thread_count.dat"
-
-struct PkThreadListPrivate
-{
-	GPtrArray		*thread_list;
-};
-
-G_DEFINE_TYPE (PkThreadList, pk_thread_list, G_TYPE_OBJECT)
-
-typedef struct
-{
-	GThread			*thread;
-	gpointer		 param;
-	gpointer		 data;
-	gboolean		 running;
-	PkThreadFunc		 func;
-} PkThreadListItem;
-
-/**
- * pk_thread_list_item_new:
- **/
-static void *
-pk_thread_list_item_new (gpointer data)
-{
-	PkThreadListItem *item = (PkThreadListItem *) data;
-	gboolean ret;
-	pk_debug ("running %p", item->func);
-	ret = item->func (item->param, item->data);
-	pk_debug ("finished %p, ret is %i", item->func, ret);
-	item->running = FALSE;
-	return NULL;
-}
-
-/**
- * pk_thread_list_create:
- **/
-gboolean
-pk_thread_list_create (PkThreadList *tlist, PkThreadFunc func, gpointer param, gpointer data)
-{
-	PkThreadListItem *item;
-
-	g_return_val_if_fail (PK_IS_THREAD_LIST (tlist), FALSE);
-	g_return_val_if_fail (func != NULL, FALSE);
-
-	item = g_new0 (PkThreadListItem, 1);
-
-	/* create a new thread object */
-	item->func = func;
-	item->param = param;
-	item->data = data;
-	item->running = TRUE;
-	item->thread = g_thread_create (pk_thread_list_item_new, item, TRUE, NULL);
-	if (item->thread == NULL) {
-		pk_warning ("thread could not be created");
-		g_free (item);
-		return FALSE;
-	}
-
-	/* add to list */
-	g_ptr_array_add (tlist->priv->thread_list, item);
-	pk_debug ("created thread %p", item->thread);
-	return TRUE;
-}
-
-/**
- * pk_thread_list_wait:
- **/
-gboolean
-pk_thread_list_wait (PkThreadList *tlist)
-{
-	guint i;
-	guint length;
-	PkThreadListItem *item;
-
-	g_return_val_if_fail (PK_IS_THREAD_LIST (tlist), FALSE);
-
-	/* wait for all the threads to finish */
-	length = tlist->priv->thread_list->len;
-	for (i=0; i<length; i++) {
-		item = (PkThreadListItem *) g_ptr_array_index (tlist->priv->thread_list, i);
-		if (item->running) {
-			pk_debug ("joining thread %p", item->thread);
-			g_thread_join (item->thread);
-		} else {
-			pk_debug ("ignoring exited thread %p", item->thread);
-		}
-	}
-	return TRUE;
-}
-
-/**
- * pk_thread_list_class_init:
- * @klass: The PkThreadListClass
- **/
-static void
-pk_thread_list_class_init (PkThreadListClass *klass)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	object_class->finalize = pk_thread_list_finalize;
-	g_type_class_add_private (klass, sizeof (PkThreadListPrivate));
-}
-
-/**
- * pk_thread_list_init:
- * @thread_list: This class instance
- **/
-static void
-pk_thread_list_init (PkThreadList *tlist)
-{
-	tlist->priv = PK_THREAD_LIST_GET_PRIVATE (tlist);
-	tlist->priv->thread_list = g_ptr_array_new ();
-}
-
-/**
- * pk_thread_free_data:
- **/
-static gboolean
-pk_thread_free_data (PkThreadList *tlist)
-{
-	guint i;
-	guint length;
-	PkThreadListItem *item;
-
-	g_return_val_if_fail (PK_IS_THREAD_LIST (tlist), FALSE);
-
-	length = tlist->priv->thread_list->len;
-	for (i=0; i<length; i++) {
-		item = (PkThreadListItem *) g_ptr_array_index (tlist->priv->thread_list, 0);
-		g_ptr_array_remove_index (tlist->priv->thread_list, 0);
-		g_free (item);
-	}
-	return TRUE;
-}
-
-/**
- * pk_thread_list_finalize:
- * @object: The object to finalize
- **/
-static void
-pk_thread_list_finalize (GObject *object)
-{
-	PkThreadList *tlist;
-
-	g_return_if_fail (object != NULL);
-	g_return_if_fail (PK_IS_THREAD_LIST (object));
-
-	tlist = PK_THREAD_LIST (object);
-	g_return_if_fail (tlist->priv != NULL);
-
-	/* wait for existing threads to finish */
-	pk_thread_list_wait (tlist);
-
-	pk_thread_free_data (tlist);
-	g_ptr_array_free (tlist->priv->thread_list, TRUE);
-	G_OBJECT_CLASS (pk_thread_list_parent_class)->finalize (object);
-}
-
-/**
- * pk_thread_list_new:
- *
- * Return value: a new PkThreadList object.
- **/
-PkThreadList *
-pk_thread_list_new (void)
-{
-	PkThreadList *tlist;
-	tlist = g_object_new (PK_TYPE_THREAD_LIST, NULL);
-	return PK_THREAD_LIST (tlist);
-}
-
-/***************************************************************************
- ***                          MAKE CHECK TESTS                           ***
- ***************************************************************************/
-#ifdef PK_BUILD_TESTS
-#include <libselftest.h>
-
-static gboolean done_func1 = FALSE;
-static gboolean done_func2 = FALSE;
-
-static gboolean
-test_func1 (PkThreadList *tlist, gpointer data)
-{
-	if (tlist != GINT_TO_POINTER(0x01) || data != GINT_TO_POINTER(0x02)) {
-		pk_debug ("WRONG PARAMS (%p, %p)", tlist, data);
-		return FALSE;
-	}
-	pk_debug ("started task (%p,%p)", tlist, data);
-	pk_delay_yield (2.0);
-	pk_debug ("exited task (%p,%p)", tlist, data);
-	done_func1 = TRUE;
-	return TRUE;
-}
-
-static gboolean
-test_func2 (PkThreadList *tlist, gpointer data)
-{
-	if (tlist != GINT_TO_POINTER(0x02) || data != GINT_TO_POINTER(0x03)) {
-		pk_debug ("WRONG PARAMS (%p, %p)", tlist, data);
-		return FALSE;
-	}
-	pk_debug ("started task (%p,%p)", tlist, data);
-	pk_delay_yield (1.0);
-	pk_debug ("exited task (%p,%p)", tlist, data);
-	done_func2 = TRUE;
-	return TRUE;
-}
-
-void
-libst_thread_list (LibSelfTest *test)
-{
-	PkThreadList *tlist;
-	gboolean ret;
-
-	if (libst_start (test, "PkThreadList", CLASS_AUTO) == FALSE) {
-		return;
-	}
-
-	tlist = pk_thread_list_new ();
-
-	/************************************************************/
-	libst_title (test, "create task 1");
-	ret = pk_thread_list_create (tlist, test_func1, GINT_TO_POINTER(0x01), GINT_TO_POINTER(0x02));
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "failed to create task1");
-	}
-
-	/************************************************************/
-	libst_title (test, "create task 2");
-	ret = pk_thread_list_create (tlist, test_func2, GINT_TO_POINTER(0x02), GINT_TO_POINTER(0x03));
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "failed to create task2");
-	}
-
-	/************************************************************/
-	libst_title (test, "wait for finish");
-	ret = pk_thread_list_wait (tlist);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "failed to wait for task");
-	}
-
-	/************************************************************/
-	libst_title (test, "ran func1 to completion");
-	if (done_func1) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "failed to run func1");
-	}
-
-	/************************************************************/
-	libst_title (test, "ran func2 to completion");
-	if (done_func2) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "failed to run func2");
-	}
-
-	g_object_unref (tlist);
-
-	libst_end (test);
-}
-#endif
-
diff --git a/src/pk-thread-list.h b/src/pk-thread-list.h
deleted file mode 100644
index 90e73aa..0000000
--- a/src/pk-thread-list.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __PK_THREAD_LIST_H
-#define __PK_THREAD_LIST_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_THREAD_LIST		(pk_thread_list_get_type ())
-#define PK_THREAD_LIST(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_THREAD_LIST, PkThreadList))
-#define PK_THREAD_LIST_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_THREAD_LIST, PkThreadListClass))
-#define PK_IS_THREAD_LIST(o)	 	(G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_THREAD_LIST))
-#define PK_IS_THREAD_LIST_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_THREAD_LIST))
-#define PK_THREAD_LIST_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_THREAD_LIST, PkThreadListClass))
-
-typedef struct PkThreadListPrivate PkThreadListPrivate;
-
-typedef struct
-{
-	 GObject		 parent;
-	 PkThreadListPrivate	*priv;
-} PkThreadList;
-
-typedef struct
-{
-	GObjectClass	parent_class;
-} PkThreadListClass;
-
-GType		 pk_thread_list_get_type	  	(void) G_GNUC_CONST;
-PkThreadList	*pk_thread_list_new			(void);
-
-typedef gboolean (*PkThreadFunc)			(PkThreadList	*tlist,
-							 gpointer	 data);
-gboolean	 pk_thread_list_create			(PkThreadList	*tlist,
-							 PkThreadFunc	 func,
-							 gpointer	 param,
-							 gpointer	 data);
-gboolean	 pk_thread_list_wait			(PkThreadList	*tlist);
-guint		 pk_thread_list_number_running		(PkThreadList	*tlist);
-
-G_END_DECLS
-
-#endif /* __PK_THREAD_LIST_H */
commit 220f47116550b1af1d1535a1ab19ac67c7313a2b
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu May 1 13:26:29 2008 +0100

    add stubs for pk_network_is_modem so that we can detect slow and expensive connections

diff --git a/libpackagekit/pk-network-dummy.c b/libpackagekit/pk-network-dummy.c
index dfb753d..1a64d5a 100644
--- a/libpackagekit/pk-network-dummy.c
+++ b/libpackagekit/pk-network-dummy.c
@@ -83,11 +83,27 @@ G_DEFINE_TYPE (PkNetwork, pk_network, G_TYPE_OBJECT)
 gboolean
 pk_network_is_online (PkNetwork *network)
 {
+	g_return_val_if_fail (PK_IS_NETWORK (network), FALSE);
 	/* don't do any checks */
 	return TRUE;
 }
 
 /**
+ * pk_network_is_modem:
+ * @network: a valid #PkNetwork instance
+ *
+ * Return value: %TRUE if the network is a modem, on a slow or expensive connection
+ **/
+gboolean
+pk_network_is_modem (PkNetwork *network)
+{
+	g_return_val_if_fail (PK_IS_NETWORK (network), FALSE);
+	/* don't do any checks */
+	return TRUE;
+}
+
+
+/**
  * pk_network_class_init:
  * @klass: The PkNetworkClass
  **/
diff --git a/libpackagekit/pk-network-nm.c b/libpackagekit/pk-network-nm.c
index ad7e2ca..e3ac25a 100644
--- a/libpackagekit/pk-network-nm.c
+++ b/libpackagekit/pk-network-nm.c
@@ -96,6 +96,19 @@ pk_network_is_online (PkNetwork *network)
 }
 
 /**
+ * pk_network_is_modem:
+ * @network: a valid #PkNetwork instance
+ *
+ * Return value: %TRUE if the network is a modem, on a slow or expensive connection
+ **/
+gboolean
+pk_network_is_modem (PkNetwork *network)
+{
+	g_return_val_if_fail (PK_IS_NETWORK (network), FALSE);
+	return TRUE;
+}
+
+/**
  * pk_network_nm_changed_cb:
  **/
 static void
diff --git a/libpackagekit/pk-network.h b/libpackagekit/pk-network.h
index 96d5c7f..230b5b2 100644
--- a/libpackagekit/pk-network.h
+++ b/libpackagekit/pk-network.h
@@ -60,6 +60,7 @@ struct _PkNetworkClass
 GType		 pk_network_get_type		  	(void) G_GNUC_CONST;
 PkNetwork	*pk_network_new				(void);
 gboolean	 pk_network_is_online			(PkNetwork	*network);
+gboolean	 pk_network_is_modem			(PkNetwork	*network);
 
 G_END_DECLS
 
commit 20148e78b2dfeaccc020850674a35751afc4eb3f
Author: Scott Reeves <sreeves at novell.com>
Date:   Wed Apr 30 16:58:44 2008 -0600

    fix up group searching and start fixing arch filtering

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 9e930a3..ace0e43 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1219,7 +1219,7 @@ backend_search_group_thread (PkBackend *backend)
 	const gchar *group;
 	PkFilterEnum filters;
 
-	group = pk_backend_get_string (backend, "group");
+	group = pk_backend_get_string (backend, "search");
 	filters = (PkFilterEnum) pk_backend_get_uint (backend, "filters");
 
 	if (group == NULL) {
commit 7c4433273bebff8fff527a5df8b64d904217e17b
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 30 18:35:01 2008 +0100

    add a timeline into the html docs

diff --git a/docs/html/pk-help.html b/docs/html/pk-help.html
index 9e760df..a66b6a6 100644
--- a/docs/html/pk-help.html
+++ b/docs/html/pk-help.html
@@ -61,6 +61,37 @@ existing backends as a template for what you are trying to do.
 </tr>
 </table>
 
+<hr>
+<h3><a name="timeline">What are the planned features?</a></h3>
+<p>
+There is a rough timeline for new features - we can't do everything at once...
+If you want to work on a feature and bring it forward, please just jump on the mailing list and
+as for instructions!
+</p>
+<p>
+<b>0.2.0</b> - To be released May 2009
+</p>
+<ul>
+<li>New Transaction DBUS interface <i>(100%)</i></li>
+<li>New session DBUS interface for appications with easy interface <i>(90%)</i></li>
+<li>EULA and GPG signature support <i>(95%)</i></li>
+</ul>
+<p>
+<b>0.2.1</b> - To be released June 2009
+</p>
+<ul>
+<li>Multiple package installs in the API <i>(0%)</i></li>
+<li>Multiple package installs from gpk-install-package-name <i>(0%)</i></li>
+<li>NetworkManager integration so we can detect GPRS (and modem) connections. <i>(10%)</i></li>
+</ul>
+<p>
+<b>0.2.2</b> - To be released July 2009
+</p>
+<ul>
+<li>Multiple package installs from gpk-application <i>(0%)</i></li>
+<li>Ignoring packages from the update viewer per-session <i>(10%)</i></li>
+</ul>
+
 <p>Back to the <a href="index.html">main page</a></p>
 
 <p class="footer">
commit 731cf34c6f38c08a4eef41595ac5e26c92058f07
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 30 18:00:04 2008 +0100

     a few trivial fixes

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 387ee9e..da763f7 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -888,7 +888,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         self.allow_cancel(False)
         self.percentage(0)
         self.status(STATUS_RUNNING)
-
         txmbrs = []
         already_warned = False
         for package in packages:
@@ -1059,7 +1058,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self._check_for_reboot()
             if removedeps == False:
                 if len(self.yumbase.tsInfo) > 1:
-                    retmsg = 'package could not be removed,as other packages depend on it'
+                    retmsg = 'package could not be removed, as other packages depend on it'
                     self.error(ERROR_DEP_RESOLUTION_FAILED,retmsg)
                     return
 
@@ -1473,7 +1472,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)     # Setup Yum Config
         self.yumbase.conf.throttle = "90%"                        # Set bandwidth throttle to 40%
         self.dnlCallback = DownloadCallback(self,showNames=True)  # Download callback
-        self.yumbase.repos.setProgressBar(self.dnlCallback)     # Setup the download callback class
+        self.yumbase.repos.setProgressBar(self.dnlCallback)       # Setup the download callback class
 
 class DownloadCallback(BaseMeter):
     """ Customized version of urlgrabber.progress.BaseMeter class """
commit 23b8d3c704a12e33accf9e1b590f507a737af3c4
Author: Thomas Wood <thomas at openedhand.com>
Date:   Wed Apr 30 16:06:37 2008 +0100

    opkg: convert to new threading methods

diff --git a/backends/opkg/pk-backend-opkg.c b/backends/opkg/pk-backend-opkg.c
index f261c19..b5caad6 100644
--- a/backends/opkg/pk-backend-opkg.c
+++ b/backends/opkg/pk-backend-opkg.c
@@ -31,7 +31,6 @@
 
 #include <libopkg/opkg.h>
 
-static PkBackendThread *thread;
 static opkg_t *opkg;
 
 enum {
@@ -124,10 +123,6 @@ backend_initialize (PkBackend *backend)
 {
 	g_return_if_fail (backend != NULL);
 
-	/* we use the thread helper */
-	thread = pk_backend_thread_new ();
-
-
 	opkg = opkg_new ();
 
 	if (!opkg) {
@@ -152,8 +147,6 @@ backend_destroy (PkBackend *backend)
 {
 	g_return_if_fail (backend != NULL);
 
-	g_object_unref (thread);
-
 	opkg_free (opkg);
 }
 
@@ -169,13 +162,9 @@ pk_opkg_progress_cb (opkg_t *opkg, int percent, void *data)
 }
 
 static gboolean
-backend_refresh_cache_thread (PkBackendThread *thread, gpointer data)
+backend_refresh_cache_thread (PkBackend *backend)
 {
 	int ret;
-	PkBackend *backend;
-
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (thread);
 
 	ret = opkg_update_package_lists (opkg, pk_opkg_progress_cb, backend);
 	if (ret) {
@@ -198,9 +187,7 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
 	pk_backend_no_percentage_updates (backend);
 
 
-	pk_backend_thread_create_old (thread,
-		(PkBackendThreadFuncOld) backend_refresh_cache_thread,
-		NULL);
+	pk_backend_thread_create (backend, backend_refresh_cache_thread);
 }
 
 /**
@@ -269,12 +256,16 @@ pk_opkg_package_list_cb (opkg_t *opkg, opkg_package_t *pkg, void *data)
 }
 
 static gboolean
-backend_search_thread (PkBackendThread *thread, SearchParams *params)
+backend_search_thread (PkBackend *backend)
 {
+	SearchParams *params;
+
+	params = pk_backend_get_pointer (backend, "search-params");
 
 	opkg_list_packages (opkg, pk_opkg_package_list_cb, params);
 
 	pk_backend_finished (params->backend);
+
 	g_free (params->needle);
 	g_free (params);
 
@@ -297,7 +288,8 @@ backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *sear
 	params->needle = g_utf8_strdown (search, -1);
 	params->backend = backend;
 
-	pk_backend_thread_create_old (thread, (PkBackendThreadFuncOld) backend_search_thread, params);
+	pk_backend_set_pointer (backend, "search-params", params);
+	pk_backend_thread_create (backend, backend_search_thread);
 }
 
 /**
@@ -318,7 +310,8 @@ backend_search_description (PkBackend *backend, PkFilterEnum filters, const gcha
 	params->search_type = SEARCH_DESCRIPTION;
 	params->needle = g_utf8_strdown (search, -1);
 
-	pk_backend_thread_create_old (thread, (PkBackendThreadFuncOld) backend_search_thread, params);
+	pk_backend_set_pointer (backend, "search-params", params);
+	pk_backend_thread_create (backend, backend_search_thread);
 }
 
 static void
@@ -336,21 +329,19 @@ backend_search_group (PkBackend *backend, PkFilterEnum filters, const gchar *sea
 	params->search_type = SEARCH_TAG;
 	params->needle = g_strdup_printf ("group::%s", search);
 
-	pk_backend_thread_create_old (thread, (PkBackendThreadFuncOld) backend_search_thread, params);
+	pk_backend_set_pointer (backend, "search-params", params);
+	pk_backend_thread_create (backend, backend_search_thread);
 }
 
 
-
-
 static gboolean
-backend_install_package_thread (PkBackendThread *thread, gchar *package_id)
+backend_install_package_thread (PkBackend *backend)
 {
 	PkPackageId *pi;
 	gint err;
-	PkBackend *backend;
+	const gchar *package_id;
 
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (thread);
+	package_id = pk_backend_get_string (backend, "pkid");
 
 	pi = pk_package_id_new_from_string (package_id);
 
@@ -358,7 +349,6 @@ backend_install_package_thread (PkBackendThread *thread, gchar *package_id)
 	if (err != 0)
 		opkg_unknown_error (backend, err, "Install");
 
-	g_free (package_id);
 	pk_package_id_free (pi);
 	pk_backend_finished (backend);
 	return (err == 0);
@@ -372,31 +362,28 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
 	pk_backend_no_percentage_updates (backend);
 	pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL);
 
-	pk_backend_thread_create_old (thread,
-		(PkBackendThreadFuncOld) backend_install_package_thread,
-		g_strdup (package_id));
+	pk_backend_set_string (backend, "pkid", package_id);
+
+	pk_backend_thread_create (backend, backend_install_package_thread);
 }
 
 static gboolean
-backend_remove_package_thread (PkBackendThread *thread, gpointer data[3])
+backend_remove_package_thread (PkBackend *backend)
 {
 	PkPackageId *pi;
 	gint err;
-	PkBackend *backend;
-	gchar *package_id;
+	const gchar *package_id;
 	gboolean allow_deps;
 	gboolean autoremove;
+	gpointer *data;
 
+	data = pk_backend_get_pointer (backend, "remove-params");
 
 	package_id = (gchar*) data[0];
 	allow_deps = GPOINTER_TO_INT (data[1]);
 	autoremove = GPOINTER_TO_INT (data[2]);
 	g_free (data);
 
-
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (thread);
-
 	pi = pk_package_id_new_from_string (package_id);
 
 	opkg_set_option (opkg, "autoremove", &autoremove);
@@ -408,7 +395,6 @@ backend_remove_package_thread (PkBackendThread *thread, gpointer data[3])
 	if (err != 0)
 		opkg_unknown_error (backend, err, "Remove");
 
-	g_free (package_id);
 	pk_package_id_free (pi);
 	pk_backend_finished (backend);
 	return (err == 0);
@@ -430,9 +416,9 @@ backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean al
 	params[1] = GINT_TO_POINTER (allow_deps);
 	params[2] = GINT_TO_POINTER (autoremove);
 
-	pk_backend_thread_create_old (thread,
-		(PkBackendThreadFuncOld) backend_remove_package_thread,
-		params);
+	pk_backend_set_pointer (backend, "remove-params", params);
+
+	pk_backend_thread_create (backend, backend_remove_package_thread);
 
 }
 
@@ -450,13 +436,9 @@ backend_get_filters (PkBackend *backend)
 
 
 static gboolean
-backend_update_system_thread (PkBackendThread *thread, gpointer data)
+backend_update_system_thread (PkBackend *backend)
 {
 	gint err;
-	PkBackend *backend;
-
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (thread);
 
 	opkg_upgrade_all (opkg, pk_opkg_progress_cb, backend);
 
@@ -474,24 +456,20 @@ backend_update_system (PkBackend *backend)
 	pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
 	pk_backend_no_percentage_updates (backend);
 
-	pk_backend_thread_create_old (thread,
-		(PkBackendThreadFuncOld) backend_update_system_thread,
-		NULL);
+	pk_backend_thread_create (backend, backend_update_system_thread);
 }
 
 /**
  * backend_update_package:
  */
 static gboolean
-backend_update_package_thread (PkBackendThread *thread, gchar *package_id)
+backend_update_package_thread (PkBackend *backend)
 {
 	PkPackageId *pi;
 	gint err = 0;
-	PkBackend *backend;
-
-	/* get current backend */
-	backend = pk_backend_thread_get_backend (thread);
+	const gchar *package_id;
 
+	package_id = pk_backend_get_string (backend, "pkgid");
 	pi = pk_package_id_new_from_string (package_id);
 
 	if (!pi->name || !pi->version)
@@ -509,7 +487,6 @@ backend_update_package_thread (PkBackendThread *thread, gchar *package_id)
 		opkg_unknown_error (backend, err, "Update package");
 	}
 
-	g_free (package_id);
 	pk_package_id_free (pi);
 	pk_backend_finished (backend);
 	return (err != 0);
@@ -518,15 +495,16 @@ backend_update_package_thread (PkBackendThread *thread, gchar *package_id)
 static void
 backend_update_packages (PkBackend *backend, gchar **package_ids)
 {
+	gint i;
 	g_return_if_fail (backend != NULL);
 
 	pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
 	pk_backend_no_percentage_updates (backend);
 
-	pk_backend_thread_create_old (thread,
-		(PkBackendThreadFuncOld) backend_update_package_thread,
-		/* TODO: process the entire list */
-		g_strdup (package_ids[0]));
+	for (i = 0; package_ids[i]; i++) {
+		pk_backend_set_string (backend, "pkgid", package_ids[i]);
+		pk_backend_thread_create (backend, backend_update_package_thread);
+	}
 }
 
 /**
@@ -552,12 +530,9 @@ pk_opkg_list_upgradable_cb (opkg_t *opkg, opkg_package_t *pkg, void *data)
 }
 
 static gboolean
-backend_get_updates_thread (PkBackendThread *thread, gpointer data)
+backend_get_updates_thread (PkBackend *backend)
 {
-	PkBackend *backend = PK_BACKEND (data);
-
 	opkg_list_upgradable_packages (opkg, pk_opkg_list_upgradable_cb, backend);
-
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -570,9 +545,7 @@ backend_get_updates (PkBackend *backend, PkFilterEnum filters)
 	pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
 	pk_backend_no_percentage_updates (backend);
 
-	pk_backend_thread_create_old (thread,
-		(PkBackendThreadFuncOld) backend_get_updates_thread,
-		backend);
+	pk_backend_thread_create (backend, backend_get_updates_thread);
 }
 
 /**
commit 19dc110bfca7bf95500dc348265638c603d2802f
Merge: a6ceeed... 0a408b8...
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date:   Wed Apr 30 13:06:31 2008 +0200

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

commit a6ceeed8b6afc6ab6b10b10c16069d5dd3916281
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date:   Wed Apr 30 13:06:13 2008 +0200

    poldek: create PercentageData in every method that needs it. It can't be created in the initalize as hash_pointer table is cleaned up in pk_backend_finished_delay

diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 4a50c73..8876b89 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -1168,7 +1168,9 @@ poldek_backend_log (void *data, int pri, char *message)
 
 	/* catch vfff messages */
 	if (g_str_has_prefix (message, "vfff: ")) {
-		if (g_str_has_prefix (message, "vfff: Inter")) // 'Interrupted system call'
+		if (g_str_has_prefix (message + 6, "Inter")) // 'Interrupted system call'
+			return;
+		else if (g_str_has_prefix (message + 6, "connection cancell")) // 'connection cancelled'
 			return;
 
 		/* check if this message was already showed */
@@ -1202,10 +1204,26 @@ poldek_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel, gboo
 }
 
 static void
-do_poldek_init (PkBackend *backend)
+poldek_backend_percentage_data_create (PkBackend *backend)
+{
+	PercentageData *data;
+
+	data = g_new0 (PercentageData, 1);
+	pk_backend_set_pointer (backend, "percentage_ptr", data);
+}
+
+static void
+poldek_backend_percentage_data_destroy (PkBackend *backend)
 {
-	PercentageData *pd;
+	PercentageData *data;
 
+	data = (gpointer) pk_backend_get_pointer (backend, "percentage_ptr");
+	g_free (data);
+}
+
+static void
+do_poldek_init (PkBackend *backend)
+{
 	poldeklib_init ();
 
 	ctx = poldek_new (0);
@@ -1216,9 +1234,6 @@ do_poldek_init (PkBackend *backend)
 
 	cctx = poclidek_new (ctx);
 
-	pd = g_new0 (PercentageData, 1);
-	pk_backend_set_pointer (backend, "percentage_ptr", pd);
-
 	poldek_set_verbose (1);
 	/* disable LOGFILE and LOGTTY logging */
 	poldek_configure (ctx, POLDEK_CONF_LOGFILE, NULL);
@@ -1241,12 +1256,8 @@ do_poldek_init (PkBackend *backend)
 static void
 do_poldek_destroy (PkBackend *backend)
 {
-	PercentageData *pd;
 	sigint_destroy ();
 
-	pd = (gpointer) pk_backend_get_pointer (backend, "percentage_ptr");
-	g_free (pd);
-
 	poclidek_free (cctx);
 	poldek_free (ctx);
 
@@ -1746,6 +1757,8 @@ backend_install_package_thread (PkBackend *backend)
 	poldek_ts_free (ts);
 	poclidek_rcmd_free (rcmd);
 
+	poldek_backend_percentage_data_destroy (backend);
+
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -1762,6 +1775,7 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
 	poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
 	pb_error_clean ();
 
+	poldek_backend_percentage_data_create (backend);
 	pk_backend_thread_create (backend, backend_install_package_thread);
 }
 
@@ -1817,6 +1831,8 @@ backend_refresh_cache_thread (PkBackend *backend)
 
 	pk_backend_set_percentage (backend, 100);
 
+	poldek_backend_percentage_data_destroy (backend);
+
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -1824,16 +1840,17 @@ backend_refresh_cache_thread (PkBackend *backend)
 static void
 backend_refresh_cache (PkBackend *backend, gboolean force)
 {
-	pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
-	poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
-	pb_error_clean ();
-
 	if (!pk_backend_is_online (backend)) {
 		pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache when offline!");
 		pk_backend_finished (backend);
 		return;
 	}
 
+	pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
+	poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
+	pb_error_clean ();
+
+	poldek_backend_percentage_data_create (backend);
 	pk_backend_thread_create (backend, backend_refresh_cache_thread);
 }
 
@@ -2025,6 +2042,8 @@ backend_update_packages_thread (PkBackend *backend)
 	if (!update_cancelled)
 		pk_backend_set_percentage (backend, 100);
 
+	poldek_backend_percentage_data_destroy (backend);
+
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -2033,7 +2052,6 @@ static void
 backend_update_packages (PkBackend *backend, gchar **package_ids)
 {
 	if (!pk_backend_is_online (backend)) {
-
 		pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update packages when offline!");
 		pk_backend_finished (backend);
 		return;
@@ -2042,6 +2060,7 @@ backend_update_packages (PkBackend *backend, gchar **package_ids)
 	poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
 	pb_error_clean ();
 
+	poldek_backend_percentage_data_create (backend);
 	pk_backend_set_uint (backend, "ts_type", TS_TYPE_ENUM_UPDATE);
 	pk_backend_thread_create (backend, backend_update_packages_thread);
 }
@@ -2140,6 +2159,8 @@ backend_update_system_thread (PkBackend *backend)
 	if (!update_cancelled)
 		pk_backend_set_percentage (backend, 100);
 
+	poldek_backend_percentage_data_destroy (backend);
+
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -2156,6 +2177,7 @@ backend_update_system (PkBackend *backend)
 	poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
 	pb_error_clean ();
 
+	poldek_backend_percentage_data_create (backend);
 	pk_backend_set_uint (backend, "ts_type", TS_TYPE_ENUM_UPDATE);
 	pk_backend_thread_create (backend, backend_update_system_thread);
 }
commit e3465a2cb7e2684e14a7bcd6c7132570d339e3b9
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date:   Wed Apr 30 12:17:26 2008 +0200

    poldek: fix build after "convert the poldek backend (..)"

diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 21f457c..4a50c73 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -36,7 +36,7 @@
 #include <sigint/sigint.h>
 
 static gchar* poldek_pkg_evr (const struct pkg *pkg);
-static void poldek_backend_package (const struct pkg *pkg, gint status);
+static void poldek_backend_package (PkBackend *backend, const struct pkg *pkg, gint status);
 static long do_get_bytes_to_download (const struct poldek_ts *ts, const gchar *mark);
 static gint do_get_files_to_download (const struct poldek_ts *ts, const gchar *mark);
 static void pb_load_packages (PkBackend *backend);
@@ -202,7 +202,7 @@ poldek_vf_progress_new (void *data, const gchar *label)
 
 		if (pkgs) {
 			pkg = n_array_nth (pkgs, 0);
-			poldek_backend_package (pkg, PK_INFO_ENUM_DOWNLOADING);
+			poldek_backend_package (backend, pkg, PK_INFO_ENUM_DOWNLOADING);
 		}
 
 		poclidek_rcmd_free (rcmd);
@@ -370,7 +370,7 @@ ts_confirm (void *data, struct poldek_ts *ts)
 					struct pkg	*rpkg = n_array_nth (rpkgs, i);
 
 					if (!poldek_pkg_in_array (rpkg, upkgs, (tn_fn_cmp)pkg_cmp_name))
-						poldek_backend_package (rpkg, PK_INFO_ENUM_REMOVING);
+						poldek_backend_package (backend, rpkg, PK_INFO_ENUM_REMOVING);
 				}
 			}
 
@@ -379,7 +379,7 @@ ts_confirm (void *data, struct poldek_ts *ts)
 					struct pkg	*dpkg = n_array_nth (dpkgs, i);
 
 					if (!poldek_pkg_in_array (dpkg, upkgs, (tn_fn_cmp)pkg_cmp_name))
-						poldek_backend_package (dpkg, PK_INFO_ENUM_INSTALLING);
+						poldek_backend_package (backend, dpkg, PK_INFO_ENUM_INSTALLING);
 				}
 			}
 
@@ -388,14 +388,14 @@ ts_confirm (void *data, struct poldek_ts *ts)
 					struct pkg	*ipkg = n_array_nth (ipkgs, i);
 
 					if (!poldek_pkg_in_array (ipkg, upkgs, (tn_fn_cmp)pkg_cmp_name))
-						poldek_backend_package (ipkg, PK_INFO_ENUM_INSTALLING);
+						poldek_backend_package (backend, ipkg, PK_INFO_ENUM_INSTALLING);
 				}
 			}
 
 			for (i = 0; i < n_array_size (upkgs); i++) {
 				struct pkg	*upkg = n_array_nth (upkgs, i);
 
-				poldek_backend_package (upkg, PK_INFO_ENUM_UPDATING);
+				poldek_backend_package (backend, upkg, PK_INFO_ENUM_UPDATING);
 			}
 
 			/* set proper status if there are no packages to download */
@@ -423,7 +423,7 @@ ts_confirm (void *data, struct poldek_ts *ts)
 				for (i = 0; i < n_array_size (dpkgs); i++) {
 					struct pkg	*pkg = n_array_nth (dpkgs, i);
 
-					poldek_backend_package (pkg, PK_INFO_ENUM_REMOVING);
+					poldek_backend_package (backend, pkg, PK_INFO_ENUM_REMOVING);
 				}
 			}
 
@@ -431,7 +431,7 @@ ts_confirm (void *data, struct poldek_ts *ts)
 				for (i = 0; i < n_array_size (rpkgs); i++) {
 					struct pkg	*pkg = n_array_nth (rpkgs, i);
 
-					poldek_backend_package (pkg, PK_INFO_ENUM_REMOVING);
+					poldek_backend_package (backend, pkg, PK_INFO_ENUM_REMOVING);
 				}
 			}
 
@@ -803,7 +803,7 @@ do_depends (tn_array *installed, tn_array *available, tn_array *depends, struct
  * poldek_backend_package:
  */
 static void
-poldek_backend_package (const struct pkg *pkg, gint status)
+poldek_backend_package (PkBackend *backend, const struct pkg *pkg, gint status)
 {
 	struct pkguinf	*pkgu;
 	gchar		*evr, *package_id, *poldek_dir;
@@ -921,7 +921,6 @@ search_package_thread (PkBackend *backend)
 	struct poclidek_rcmd	*cmd = NULL;
 	const gchar *search;
 	guint mode;
-	PkFilterEnum filters;
 
 	pb_load_packages (backend);
 
@@ -1064,7 +1063,7 @@ search_package_thread (PkBackend *backend)
 					}
 				}
 
-				poldek_backend_package (pkg, PK_INFO_ENUM_UNKNOWN);
+				poldek_backend_package (backend, pkg, PK_INFO_ENUM_UNKNOWN);
 			}
 			n_array_free (pkgs);
 		} else {
@@ -1159,6 +1158,7 @@ pb_error_clean (void)
 static void
 poldek_backend_log (void *data, int pri, char *message)
 {
+	PkBackend *backend = (PkBackend*)data;
 
 	/* skip messages that we don't want to show */
 	if (g_str_has_prefix (message, "Nothing")) // 'Nothing to do'
@@ -1202,7 +1202,7 @@ poldek_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel, gboo
 }
 
 static void
-do_poldek_init (void)
+do_poldek_init (PkBackend *backend)
 {
 	PercentageData *pd;
 
@@ -1224,7 +1224,7 @@ do_poldek_init (void)
 	poldek_configure (ctx, POLDEK_CONF_LOGFILE, NULL);
 	poldek_configure (ctx, POLDEK_CONF_LOGTTY, NULL);
 
-	poldek_log_set_appender ("PackageKit", NULL, NULL, 0, (poldek_vlog_fn)poldek_backend_log);
+	poldek_log_set_appender ("PackageKit", (void *)backend, NULL, 0, (poldek_vlog_fn)poldek_backend_log);
 
 	/* disable unique package names */
 	poldek_configure (ctx, POLDEK_CONF_OPT, POLDEK_OP_UNIQN, 0);
@@ -1239,7 +1239,7 @@ do_poldek_init (void)
 }
 
 static void
-do_poldek_destroy (void)
+do_poldek_destroy (PkBackend *backend)
 {
 	PercentageData *pd;
 	sigint_destroy ();
@@ -1255,8 +1255,8 @@ do_poldek_destroy (void)
 
 static void
 poldek_reload (PkBackend *backend, gboolean load_packages) {
-	do_poldek_destroy ();
-	do_poldek_init ();
+	do_poldek_destroy (backend);
+	do_poldek_init (backend);
 
 	if (load_packages)
 		pb_load_packages (backend);
@@ -1275,7 +1275,7 @@ backend_initalize (PkBackend *backend)
 	if (ref++ > 1)
 		return;
 
-	do_poldek_init ();
+	do_poldek_init (backend);
 }
 /**
  * backend_destroy:
@@ -1286,7 +1286,7 @@ backend_destroy (PkBackend *backend)
 	if (ref-- > 0)
 		return;
 
-	do_poldek_destroy ();
+	do_poldek_destroy (backend);
 
 	/* release PbError struct */
 	g_free (pberror->vfffmsg);
@@ -1348,7 +1348,7 @@ backend_get_depends_thread (PkBackend *backend)
 	for (i = 0; i < n_array_size (deppkgs); i++) {
 		struct pkg	*p = n_array_nth (deppkgs, i);
 
-		poldek_backend_package (p, PK_INFO_ENUM_UNKNOWN);
+		poldek_backend_package (backend, p, PK_INFO_ENUM_UNKNOWN);
 	}
 
 	pkg_free (pkg);
@@ -1375,10 +1375,13 @@ backend_get_depends (PkBackend *backend, PkFilterEnum filters, const gchar *pack
  * backend_get_description:
  */
 static gboolean
-backend_get_description_thread (PkBackend *backend, gchar *package_id)
+backend_get_description_thread (PkBackend *backend)
 {
+	const gchar *package_id;
 	struct pkg	*pkg = NULL;
 
+	package_id = pk_backend_get_string (backend, "package_id");
+
 	pb_load_packages (backend);
 
 	pkg = poldek_get_pkg_from_package_id (package_id);
@@ -1411,8 +1414,6 @@ backend_get_description_thread (PkBackend *backend, gchar *package_id)
 		pkg_free (pkg);
 	}
 
-	g_free (package_id);
-
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -1424,17 +1425,20 @@ backend_get_description (PkBackend *backend, const gchar *package_id)
 	poldek_backend_set_allow_cancel (backend, FALSE, TRUE);
 	pb_error_clean ();
 
-	pk_backend_thread_create (thread, backend_get_description_thread);
+	pk_backend_thread_create (backend, backend_get_description_thread);
 }
 
 /**
  * backend_get_files:
  */
 static gboolean
-backend_get_files_thread (PkBackend *backend, gchar *package_id)
+backend_get_files_thread (PkBackend *backend)
 {
+	const gchar *package_id;
 	struct pkg	*pkg;
 
+	package_id = pk_backend_get_string (backend, "package_id");
+
 	pb_load_packages (backend);
 
 	pkg = poldek_get_pkg_from_package_id (package_id);
@@ -1483,8 +1487,6 @@ backend_get_files_thread (PkBackend *backend, gchar *package_id)
 		pkg_free (pkg);
 	}
 
-	g_free (package_id);
-
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -1496,7 +1498,7 @@ backend_get_files (PkBackend *backend, const gchar *package_id)
 	poldek_backend_set_allow_cancel (backend, FALSE, TRUE);
 	pb_error_clean ();
 
-	pk_backend_thread_create (thread, backend_get_files_thread);
+	pk_backend_thread_create (backend, backend_get_files_thread);
 }
 
 /**
@@ -1541,7 +1543,7 @@ backend_get_requires_thread (PkBackend *backend)
 	for (i = 0; i < n_array_size (reqpkgs); i++) {
 		struct pkg	*p = n_array_nth (reqpkgs, i);
 
-		poldek_backend_package (p, PK_INFO_ENUM_UNKNOWN);
+		poldek_backend_package (backend, p, PK_INFO_ENUM_UNKNOWN);
 	}
 
 	n_array_free (reqpkgs);
@@ -1566,12 +1568,15 @@ backend_get_requires (PkBackend	*backend, PkFilterEnum filters, const gchar *pac
  * backend_get_update_detail:
  */
 static gboolean
-backend_get_update_detail_thread (PkBackend *backend, gchar *package_id)
+backend_get_update_detail_thread (PkBackend *backend)
 {
 	PkPackageId	*pi;
+	const gchar *package_id;
 	struct poclidek_rcmd	*rcmd;
 	gchar		*command;
 
+	package_id = pk_backend_get_string (backend, "package_id");
+
 	pb_load_packages (backend);
 
 	pi = pk_package_id_new_from_string (package_id);
@@ -1640,7 +1645,7 @@ backend_get_update_detail (PkBackend *backend, const gchar *package_id)
 	poldek_backend_set_allow_cancel (backend, FALSE, TRUE);
 	pb_error_clean ();
 
-	pk_backend_thread_create (thread, backend_get_update_detail_thread);
+	pk_backend_thread_create (backend, backend_get_update_detail_thread);
 }
 
 /**
@@ -1673,9 +1678,9 @@ backend_get_updates_thread (PkBackend *backend)
 
 				/* mark held packages as blocked */
 				if (pkg->flags & PKG_HELD)
-					poldek_backend_package (pkg, PK_INFO_ENUM_BLOCKED);
+					poldek_backend_package (backend, pkg, PK_INFO_ENUM_BLOCKED);
 				else
-					poldek_backend_package (pkg, PK_INFO_ENUM_NORMAL);
+					poldek_backend_package (backend, pkg, PK_INFO_ENUM_NORMAL);
 			}
 			n_array_free (pkgs);
 		}
@@ -1838,7 +1843,6 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
 static gboolean
 backend_remove_package_thread (PkBackend *backend)
 {
-	PkBackend		*backend = (PkBackend *) data;
 	struct poclidek_rcmd	*rcmd;
 	struct poldek_ts	*ts;
 	gchar			*nvra, *command;


More information about the PackageKit-commit mailing list