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

Richard Hughes hughsient at kemper.freedesktop.org
Fri Apr 11 04:51:02 PDT 2008


 backends/alpm/pk-backend-alpm.c     |   17 
 backends/box/pk-backend-box.c       |   14 
 backends/poldek/pk-backend-poldek.c |   18 
 backends/zypp/pk-backend-zypp.cpp   |   36 -
 client/pk-console.c                 |   34 +
 docs/api/PackageKit-docs.sgml       |    1 
 libpackagekit/Makefile.am           |    3 
 libpackagekit/pk-control.c          |   56 +-
 libpackagekit/pk-control.h          |    7 
 libpackagekit/pk-enum-list.c        |  683 ------------------------------------
 libpackagekit/pk-enum-list.h        |   85 ----
 libpackagekit/pk-enum.c             |  224 +++++++++++
 libpackagekit/pk-enum.h             |   80 ++--
 libpackagekit/pk-extra.h            |    1 
 libpackagekit/pk-self-test.c        |    1 
 src/pk-backend-dbus.h               |    1 
 src/pk-backend-internal.h           |    1 
 src/pk-backend-spawn.h              |    1 
 src/pk-backend-thread.h             |    1 
 src/pk-backend.h                    |    1 
 src/pk-transaction.h                |    1 
 21 files changed, 339 insertions(+), 927 deletions(-)

New commits:
commit 9e1a73ab80a61b5dc7164203b565aa97ab5c6167
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 12:27:21 2008 +0100

    make the status enums into bitfields

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 3c7041d..10298ab 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -1146,7 +1146,7 @@ libst_enum (LibSelfTest *test)
 
 	/************************************************************/
 	libst_title (test, "check we convert all the status enums");
-	for (i=0; i<=PK_STATUS_ENUM_UNKNOWN; i++) {
+	for (i=1; i<=PK_STATUS_ENUM_UNKNOWN; i*=2) {
 		string = pk_status_enum_to_text (i);
 		if (string == NULL) {
 			libst_failed (test, "failed to get %i", i);
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index d1ad7af..fd2b1ac 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -101,27 +101,27 @@ typedef enum {
  * when they are ready to start running the transaction and after a lock has been got.
  **/
 typedef enum {
-	PK_STATUS_ENUM_WAIT,
-	PK_STATUS_ENUM_SETUP,
-	PK_STATUS_ENUM_RUNNING,
-	PK_STATUS_ENUM_QUERY,
-	PK_STATUS_ENUM_INFO,
-	PK_STATUS_ENUM_REMOVE,
-	PK_STATUS_ENUM_REFRESH_CACHE,
-	PK_STATUS_ENUM_DOWNLOAD,
-	PK_STATUS_ENUM_INSTALL,
-	PK_STATUS_ENUM_UPDATE,
-	PK_STATUS_ENUM_CLEANUP,
-	PK_STATUS_ENUM_OBSOLETE,
-	PK_STATUS_ENUM_DEP_RESOLVE,
-	PK_STATUS_ENUM_SIG_CHECK,
-	PK_STATUS_ENUM_ROLLBACK,
-	PK_STATUS_ENUM_TEST_COMMIT,
-	PK_STATUS_ENUM_COMMIT,
-	PK_STATUS_ENUM_REQUEST,
-	PK_STATUS_ENUM_FINISHED,
-	PK_STATUS_ENUM_CANCEL,
-	PK_STATUS_ENUM_UNKNOWN
+	PK_STATUS_ENUM_WAIT			= 1 << 0,
+	PK_STATUS_ENUM_SETUP			= 1 << 1,
+	PK_STATUS_ENUM_RUNNING			= 1 << 2,
+	PK_STATUS_ENUM_QUERY			= 1 << 3,
+	PK_STATUS_ENUM_INFO			= 1 << 4,
+	PK_STATUS_ENUM_REMOVE			= 1 << 5,
+	PK_STATUS_ENUM_REFRESH_CACHE		= 1 << 6,
+	PK_STATUS_ENUM_DOWNLOAD			= 1 << 7,
+	PK_STATUS_ENUM_INSTALL			= 1 << 8,
+	PK_STATUS_ENUM_UPDATE			= 1 << 9,
+	PK_STATUS_ENUM_CLEANUP			= 1 << 10,
+	PK_STATUS_ENUM_OBSOLETE			= 1 << 11,
+	PK_STATUS_ENUM_DEP_RESOLVE		= 1 << 12,
+	PK_STATUS_ENUM_SIG_CHECK		= 1 << 13,
+	PK_STATUS_ENUM_ROLLBACK			= 1 << 14,
+	PK_STATUS_ENUM_TEST_COMMIT		= 1 << 15,
+	PK_STATUS_ENUM_COMMIT			= 1 << 16,
+	PK_STATUS_ENUM_REQUEST			= 1 << 17,
+	PK_STATUS_ENUM_FINISHED			= 1 << 18,
+	PK_STATUS_ENUM_CANCEL			= 1 << 19,
+	PK_STATUS_ENUM_UNKNOWN			= 1 << 20
 } PkStatusEnum;
 
 /**
commit 781e035a56c4ef9736ddb58f91b263d5119583d4
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 12:19:27 2008 +0100

    add a useful enum habdling function pk_enums_contain_priority

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 4565179..3c7041d 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -450,6 +450,47 @@ pk_enum_find_string (PkEnumMatch *table, guint value)
 }
 
 /**
+ * pk_enums_contain_priority:
+ * @values: a valid enums instance
+ * @value: the values we are searching for
+ *
+ * Finds elements in a list, but with priority going to the preceeding entry
+ *
+ * Return value: The return enumerated type, or -1 if none are found
+ **/
+gint
+pk_enums_contain_priority (guint values, gint value, ...)
+{
+	va_list args;
+	guint i;
+	guint value_temp;
+	gint retval = -1;
+
+	/* we must query at least one thing */
+	if (pk_enums_contain (values, value)) {
+		return value;
+	}
+
+	/* process the valist */
+	va_start (args, value);
+	for (i=0;; i++) {
+		value_temp = va_arg (args, gint);
+		/* do we have this one? */
+		if (pk_enums_contain (values, value_temp)) {
+			retval = value_temp;
+			break;
+		}
+		/* end of the list */
+		if (value_temp == -1) {
+			break;
+		}
+	}
+	va_end (args);
+
+	return retval;
+}
+
+/**
  * pk_sig_type_enum_from_text:
  * @sig_type: Text describing the enumerated type
  *
@@ -1045,18 +1086,20 @@ void
 libst_enum (LibSelfTest *test)
 {
 	const gchar *string;
-	PkRoleEnum value;
+	PkRoleEnum role_value;
 	guint i;
 	gchar *text;
 	PkFilterEnum filter;
+	guint value;
+	guint values;
 
 	if (libst_start (test, "PkEnum", CLASS_AUTO) == FALSE) {
 		return;
 	}
 
 	/************************************************************/
-	libst_title (test, "find value");
-	value = pk_enum_find_value (enum_role, "search-file");
+	libst_title (test, "find role_value");
+	role_value = pk_enum_find_value (enum_role, "search-file");
 	if (PK_ROLE_ENUM_SEARCH_FILE) {
 		libst_success (test, NULL);
 	} else {
@@ -1074,7 +1117,7 @@ libst_enum (LibSelfTest *test)
 
 	/************************************************************/
 	libst_title (test, "find value");
-	value = pk_role_enum_from_text ("search-file");
+	role_value = pk_role_enum_from_text ("search-file");
 	if (PK_ROLE_ENUM_SEARCH_FILE) {
 		libst_success (test, NULL);
 	} else {
@@ -1319,6 +1362,34 @@ libst_enum (LibSelfTest *test)
 	}
 	g_free (text);
 
+	/************************************************************/
+	libst_title (test, "priority check missing");
+	values = PK_ROLE_ENUM_SEARCH_DETAILS | PK_ROLE_ENUM_SEARCH_GROUP;
+	value = pk_enums_contain_priority (values, PK_ROLE_ENUM_SEARCH_FILE, -1);
+	if (value == -1) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "returned priority %i when should be missing", value);
+	}
+
+	/************************************************************/
+	libst_title (test, "priority check first");
+	value = pk_enums_contain_priority (values, PK_ROLE_ENUM_SEARCH_GROUP, -1);
+	if (value == PK_ROLE_ENUM_SEARCH_GROUP) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "returned wrong value; %i", value);
+	}
+
+	/************************************************************/
+	libst_title (test, "priority check second, correct");
+	value = pk_enums_contain_priority (values, PK_ROLE_ENUM_SEARCH_FILE, PK_ROLE_ENUM_SEARCH_GROUP, -1);
+	if (value == PK_ROLE_ENUM_SEARCH_GROUP) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "returned wrong value; %i", value);
+	}
+
 	libst_end (test);
 }
 #endif
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 7344e09..d1ad7af 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -469,6 +469,8 @@ guint		 pk_enum_find_value			(PkEnumMatch	*table,
 const gchar	*pk_enum_find_string			(PkEnumMatch	*table,
 							 guint		 value)
 							 G_GNUC_WARN_UNUSED_RESULT;
+gint		 pk_enums_contain_priority		(guint		 values,
+							 gint		 value, ...);
 
 PkSigTypeEnum    pk_sig_type_enum_from_text             (const gchar    *sig_type);
 const gchar     *pk_sig_type_enum_to_text               (PkSigTypeEnum   sig_type);
commit b8e8e9b8e9f935823ce17b1560e5d6b7de0aa57b
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 12:08:30 2008 +0100

    convert the info types to be a bitfield

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 6bfc8f6..4565179 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -1191,7 +1191,7 @@ libst_enum (LibSelfTest *test)
 
 	/************************************************************/
 	libst_title (test, "check we convert all the info enums");
-	for (i=0; i<=PK_INFO_ENUM_UNKNOWN; i++) {
+	for (i=1; i<=PK_INFO_ENUM_UNKNOWN; i*=2) {
 		string = pk_info_enum_to_text (i);
 		if (string == NULL) {
 			libst_failed (test, "failed to get %i", i);
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 5993403..7344e09 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -297,22 +297,22 @@ typedef enum {
  * package action, rather than a general state
  **/
 typedef enum {
-	PK_INFO_ENUM_INSTALLED,
-	PK_INFO_ENUM_AVAILABLE,
-	PK_INFO_ENUM_LOW,
-	PK_INFO_ENUM_NORMAL,
-	PK_INFO_ENUM_IMPORTANT,
-	PK_INFO_ENUM_SECURITY,
-	PK_INFO_ENUM_BUGFIX,
-	PK_INFO_ENUM_ENHANCEMENT,
-	PK_INFO_ENUM_BLOCKED,
-	PK_INFO_ENUM_DOWNLOADING,
-	PK_INFO_ENUM_UPDATING,
-	PK_INFO_ENUM_INSTALLING,
-	PK_INFO_ENUM_REMOVING,
-	PK_INFO_ENUM_CLEANUP,
-	PK_INFO_ENUM_OBSOLETING,
-	PK_INFO_ENUM_UNKNOWN
+	PK_INFO_ENUM_INSTALLED			= 1 << 0,
+	PK_INFO_ENUM_AVAILABLE			= 1 << 1,
+	PK_INFO_ENUM_LOW			= 1 << 2,
+	PK_INFO_ENUM_NORMAL			= 1 << 3,
+	PK_INFO_ENUM_IMPORTANT			= 1 << 4,
+	PK_INFO_ENUM_SECURITY			= 1 << 5,
+	PK_INFO_ENUM_BUGFIX			= 1 << 6,
+	PK_INFO_ENUM_ENHANCEMENT		= 1 << 7,
+	PK_INFO_ENUM_BLOCKED			= 1 << 8,
+	PK_INFO_ENUM_DOWNLOADING		= 1 << 9,
+	PK_INFO_ENUM_UPDATING			= 1 << 10,
+	PK_INFO_ENUM_INSTALLING			= 1 << 11,
+	PK_INFO_ENUM_REMOVING			= 1 << 12,
+	PK_INFO_ENUM_CLEANUP			= 1 << 13,
+	PK_INFO_ENUM_OBSOLETING			= 1 << 14,
+	PK_INFO_ENUM_UNKNOWN			= 1 << 15
 } PkInfoEnum;
 
 /**
commit 3520acff265ef29b100594a0ce99f5eb6ba8349b
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 12:05:02 2008 +0100

    a couple of buildfixes

diff --git a/libpackagekit/pk-self-test.c b/libpackagekit/pk-self-test.c
index b964f63..1e94065 100644
--- a/libpackagekit/pk-self-test.c
+++ b/libpackagekit/pk-self-test.c
@@ -56,7 +56,6 @@ main (int argc, char **argv)
 	libst_package_ids (&test);
 	libst_package_list (&test);
 	libst_enum (&test);
-	libst_enum_list (&test);
 	libst_extra (&test);
 	libst_extra_obj (&test);
 	libst_client (&test);
diff --git a/src/pk-backend-internal.h b/src/pk-backend-internal.h
index f830654..2213fed 100644
--- a/src/pk-backend-internal.h
+++ b/src/pk-backend-internal.h
@@ -23,7 +23,6 @@
 #define __PK_BACKEND_INTERNAL_H
 
 #include <glib-object.h>
-#include <pk-enum-list.h>
 #include "pk-backend.h"
 
 G_BEGIN_DECLS
diff --git a/src/pk-backend-spawn.h b/src/pk-backend-spawn.h
index cff414a..b16149e 100644
--- a/src/pk-backend-spawn.h
+++ b/src/pk-backend-spawn.h
@@ -23,7 +23,6 @@
 #define __PK_BACKEND_SPAWN_H
 
 #include <glib-object.h>
-#include <pk-enum-list.h>
 #include "pk-backend.h"
 
 G_BEGIN_DECLS
commit 6d5bb603d7391b1c68e687d885043b74483e4a71
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 11:50:13 2008 +0100

    remove pk-enum-list as we can do this using enums now

diff --git a/client/pk-console.c b/client/pk-console.c
index 4b0bca4..fd8dfe0 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -35,14 +35,13 @@
 #include <pk-client.h>
 #include <pk-control.h>
 #include <pk-package-id.h>
-#include <pk-enum-list.h>
 #include <pk-common.h>
 #include <pk-connection.h>
 
 #define PROGRESS_BAR_SIZE 15
 
 static GMainLoop *loop = NULL;
-static PkEnumList *role_list = NULL;
+static PkRoleEnum roles;
 static gboolean is_console = FALSE;
 static gboolean has_output_bar = FALSE;
 static gboolean need_requeue = FALSE;
@@ -632,7 +631,7 @@ pk_console_remove_package (PkClient *client, const gchar *package, GError **erro
 	}
 
 	/* are we dumb and can't check for requires? */
-	if (pk_enum_list_contains (role_list, PK_ROLE_ENUM_GET_REQUIRES) == FALSE) {
+	if (!pk_enums_contain (roles, PK_ROLE_ENUM_GET_REQUIRES)) {
 		/* no, just try to remove it without deps */
 		ret = pk_console_remove_only (client, package_id, FALSE, FALSE, error);
 		g_free (package_id);
@@ -810,7 +809,10 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 	const gchar *value = NULL;
 	const gchar *details = NULL;
 	const gchar *parameter = NULL;
-	PkEnumList *elist;
+	PkRoleEnum roles;
+	PkGroupEnum groups;
+	PkFilterEnum filters;
+	gchar *text;
 	gboolean ret = FALSE;
 	gboolean maybe_sync = TRUE;
 
@@ -994,21 +996,24 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 		} else if (strcmp (value, "packages") == 0) {
 			ret = pk_client_get_packages (client, PK_FILTER_ENUM_INSTALLED, error);
 		} else if (strcmp (value, "actions") == 0) {
-			elist = pk_control_get_actions (control);
-			pk_enum_list_print (elist);
-			g_object_unref (elist);
+			roles = pk_control_get_actions (control);
+			text = pk_role_enums_to_text (roles);
+			g_print ("roles=%s", text);
+			g_free (text);
 			maybe_sync = FALSE;
 		} else if (strcmp (value, "filters") == 0) {
-			elist = pk_control_get_filters (control);
-			pk_enum_list_print (elist);
-			g_object_unref (elist);
+			filters = pk_control_get_filters (control);
+			text = pk_filter_enums_to_text (filters);
+			g_print ("filters=%s", text);
+			g_free (text);
 			maybe_sync = FALSE;
 		} else if (strcmp (value, "repos") == 0) {
 			ret = pk_client_get_repo_list (client, PK_FILTER_ENUM_NONE, error);
 		} else if (strcmp (value, "groups") == 0) {
-			elist = pk_control_get_groups (control);
-			pk_enum_list_print (elist);
-			g_object_unref (elist);
+			groups = pk_control_get_groups (control);
+			text = pk_group_enums_to_text (groups);
+			g_print ("groups=%s", text);
+			g_free (text);
 			maybe_sync = FALSE;
 		} else if (strcmp (value, "transactions") == 0) {
 			ret = pk_client_get_old_transactions (client, 10, error);
@@ -1303,8 +1308,7 @@ main (int argc, char *argv[])
 			  G_CALLBACK (pk_console_signature_finished_cb), NULL);
 
 	control = pk_control_new ();
-	role_list = pk_control_get_actions (control);
-	pk_debug ("actions=%s", pk_enum_list_to_string (role_list));
+	roles = pk_control_get_actions (control);
 
 	/* run the commands */
 	ret = pk_console_process_commands (client, argc, argv, &error);
diff --git a/docs/api/PackageKit-docs.sgml b/docs/api/PackageKit-docs.sgml
index df8d798..686545a 100644
--- a/docs/api/PackageKit-docs.sgml
+++ b/docs/api/PackageKit-docs.sgml
@@ -18,7 +18,6 @@
   <chapter>
     <title>libpackagekit</title>
     <xi:include href="xml/pk-connection.xml"/>
-    <xi:include href="xml/pk-enum-list.xml"/>
     <xi:include href="xml/pk-polkit-client.xml"/>
     <xi:include href="xml/pk-extra.xml"/>
     <xi:include href="xml/pk-client.xml"/>
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index 0151824..b3859bf 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -41,7 +41,6 @@ libpackagekit_include_HEADERS =					\
 	pk-package-id.h						\
 	pk-package-ids.h					\
 	pk-package-list.h					\
-	pk-enum-list.h						\
 	pk-enum.h						\
 	pk-common.h						\
 	pk-filter.h						\
@@ -69,8 +68,6 @@ libpackagekit_la_SOURCES =					\
 	pk-package-ids.h					\
 	pk-package-list.c					\
 	pk-package-list.h					\
-	pk-enum-list.c						\
-	pk-enum-list.h						\
 	pk-enum.h						\
 	pk-enum.c						\
 	pk-common.c						\
diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index 47d9d31..2d31359 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -163,23 +163,20 @@ pk_control_error_fixup (GError **error)
  *
  * Return value: an enumerated list of the actions the backend supports
  **/
-PkEnumList *
+PkRoleEnum
 pk_control_get_actions (PkControl *control)
 {
 	gboolean ret;
 	GError *error = NULL;
 	gchar *actions;
-	PkEnumList *elist;
+	PkRoleEnum roles_enum = PK_GROUP_ENUM_UNKNOWN;
 
-	g_return_val_if_fail (PK_IS_CONTROL (control), NULL);
-
-	elist = pk_enum_list_new ();
-	pk_enum_list_set_type (elist, PK_ENUM_LIST_TYPE_ROLE);
+	g_return_val_if_fail (PK_IS_CONTROL (control), PK_GROUP_ENUM_UNKNOWN);
 
 	/* check to see if we have a valid proxy */
 	if (control->priv->proxy == NULL) {
 		pk_warning ("No proxy for manager");
-		return FALSE;
+		goto out;
 	}
 	ret = dbus_g_proxy_call (control->priv->proxy, "GetActions", &error,
 				 G_TYPE_INVALID,
@@ -189,13 +186,14 @@ pk_control_get_actions (PkControl *control)
 		/* abort as the DBUS method failed */
 		pk_warning ("GetActions failed :%s", error->message);
 		g_error_free (error);
-		return elist;
+		goto out;
 	}
 
 	/* convert to enumerated types */
-	pk_enum_list_from_string (elist, actions);
+	roles_enum = pk_role_enums_from_text (actions);
 	g_free (actions);
-	return elist;
+out:
+	return roles_enum;
 }
 
 /**
@@ -208,24 +206,20 @@ pk_control_get_actions (PkControl *control)
  *
  * Return value: an enumerated list of the groups the backend supports
  **/
-PkEnumList *
+PkGroupEnum
 pk_control_get_groups (PkControl *control)
 {
 	gboolean ret;
 	GError *error = NULL;
 	gchar *groups;
-	PkEnumList *elist;
-
-	g_return_val_if_fail (PK_IS_CONTROL (control), NULL);
+	PkGroupEnum groups_enum = PK_GROUP_ENUM_UNKNOWN;
 
-	elist = pk_enum_list_new ();
-	pk_enum_list_set_type (elist, PK_ENUM_LIST_TYPE_GROUP);
+	g_return_val_if_fail (PK_IS_CONTROL (control), PK_GROUP_ENUM_UNKNOWN);
 
 	/* check to see if we have a valid proxy */
 	if (control->priv->proxy == NULL) {
 		pk_warning ("No proxy for manager");
-		return FALSE;
-		return FALSE;
+		goto out;
 	}
 	ret = dbus_g_proxy_call (control->priv->proxy, "GetGroups", &error,
 				 G_TYPE_INVALID,
@@ -235,13 +229,14 @@ pk_control_get_groups (PkControl *control)
 		/* abort as the DBUS method failed */
 		pk_warning ("GetGroups failed :%s", error->message);
 		g_error_free (error);
-		return elist;
+		goto out;
 	}
 
 	/* convert to enumerated types */
-	pk_enum_list_from_string (elist, groups);
+	groups_enum = pk_group_enums_from_text (groups);
 	g_free (groups);
-	return elist;
+out:
+	return groups_enum;
 }
 
 /**
@@ -252,24 +247,20 @@ pk_control_get_groups (PkControl *control)
  *
  * Return value: an enumerated list of the filters the backend supports
  **/
-PkEnumList *
+PkFilterEnum
 pk_control_get_filters (PkControl *control)
 {
 	gboolean ret;
 	GError *error = NULL;
 	gchar *filters;
-	PkEnumList *elist;
-
-	g_return_val_if_fail (PK_IS_CONTROL (control), NULL);
+	PkFilterEnum filters_enum = PK_FILTER_ENUM_UNKNOWN;
 
-	elist = pk_enum_list_new ();
-	pk_enum_list_set_type (elist, PK_ENUM_LIST_TYPE_FILTER);
+	g_return_val_if_fail (PK_IS_CONTROL (control), PK_FILTER_ENUM_UNKNOWN);
 
 	/* check to see if we have a valid proxy */
 	if (control->priv->proxy == NULL) {
 		pk_warning ("No proxy for manager");
-		return FALSE;
-		return FALSE;
+		goto out;
 	}
 	ret = dbus_g_proxy_call (control->priv->proxy, "GetFilters", &error,
 				 G_TYPE_INVALID,
@@ -279,13 +270,14 @@ pk_control_get_filters (PkControl *control)
 		/* abort as the DBUS method failed */
 		pk_warning ("GetFilters failed :%s", error->message);
 		g_error_free (error);
-		return elist;
+		goto out;
 	}
 
 	/* convert to enumerated types */
-	pk_enum_list_from_string (elist, filters);
+	filters_enum = pk_filter_enums_from_text (filters);
 	g_free (filters);
-	return elist;
+out:
+	return filters_enum;
 }
 
 /**
diff --git a/libpackagekit/pk-control.h b/libpackagekit/pk-control.h
index 21c4652..fa29890 100644
--- a/libpackagekit/pk-control.h
+++ b/libpackagekit/pk-control.h
@@ -29,7 +29,6 @@
 
 #include <glib-object.h>
 #include "pk-enum.h"
-#include "pk-enum-list.h"
 
 G_BEGIN_DECLS
 
@@ -88,9 +87,9 @@ PkControl	*pk_control_new				(void);
 gboolean	 pk_control_allocate_transaction_id	(PkControl	*control,
 							 gchar		**tid,
 							 GError		**error);
-PkEnumList	*pk_control_get_actions			(PkControl	*control);
-PkEnumList	*pk_control_get_filters			(PkControl	*control);
-PkEnumList	*pk_control_get_groups			(PkControl	*control);
+PkRoleEnum	 pk_control_get_actions			(PkControl	*control);
+PkFilterEnum	 pk_control_get_filters			(PkControl	*control);
+PkGroupEnum	 pk_control_get_groups			(PkControl	*control);
 gboolean	 pk_control_get_backend_detail		(PkControl	*control,
 							 gchar		**name,
 							 gchar		**author,
diff --git a/libpackagekit/pk-enum-list.c b/libpackagekit/pk-enum-list.c
deleted file mode 100644
index 074732c..0000000
--- a/libpackagekit/pk-enum-list.c
+++ /dev/null
@@ -1,683 +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.
- */
-
-/**
- * SECTION:pk-enum-list
- * @short_description: Common functions to manifulate lists of enumerated types
- *
- * This file contains functions that can manage lists of enumerated values of
- * different types.
- * These functions will be much quicker than manipulating strings directly.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <string.h>
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#include <glib/gi18n.h>
-
-#include "pk-common.h"
-#include "pk-debug.h"
-#include "pk-enum.h"
-#include "pk-enum-list.h"
-
-static void     pk_enum_list_class_init		(PkEnumListClass *klass);
-static void     pk_enum_list_init		(PkEnumList      *enum_list);
-static void     pk_enum_list_finalize		(GObject         *object);
-
-#define PK_ENUM_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_ENUM_LIST, PkEnumListPrivate))
-
-/**
- * PkEnumListPrivate:
- *
- * Private #PkEnumList data
- **/
-struct _PkEnumListPrivate
-{
-	PkEnumListType		 type;
-	GPtrArray		*data;
-};
-
-G_DEFINE_TYPE (PkEnumList, pk_enum_list, G_TYPE_OBJECT)
-
-/**
- * pk_enum_list_set_type:
- * @elist: a valid #PkEnumList instance
- * @type: the type of list this should be
- *
- * This function sets the type of list. You don't /need/ to use this function,
- * but is required if you print or get the list as we need to know what
- * pk_xxxx_enum_to_text function to use for each part.
- *
- * Return value: %TRUE if we set the list type
- **/
-gboolean
-pk_enum_list_set_type (PkEnumList *elist, PkEnumListType type)
-{
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-	elist->priv->type = type;
-	return TRUE;
-}
-
-/**
- * pk_enum_list_append_multiple:
- * @elist: a valid #PkEnumList instance
- * @value: the initial value
- *
- * Set a many items into a list in one method. Always terminate the enum
- * list with the value -1
- *
- * Return value: %TRUE if we set the data
- **/
-gboolean
-pk_enum_list_append_multiple (PkEnumList *elist, gint value, ...)
-{
-	va_list args;
-	guint i;
-	guint value_temp;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-
-	/* create a new list. A list must have at least one entry */
-	g_ptr_array_add (elist->priv->data, GINT_TO_POINTER(value));
-
-	/* process the valist */
-	va_start (args, value);
-	for (i=0;; i++) {
-		value_temp = va_arg (args, gint);
-		if (value_temp == -1) break;
-		g_ptr_array_add (elist->priv->data, GUINT_TO_POINTER(value_temp));
-	}
-	va_end (args);
-
-	return TRUE;
-}
-
-/**
- * pk_enum_list_contains_priority:
- * @elist: a valid #PkEnumList instance
- * @value: the values we are searching for
- *
- * Finds elements in a list, but with priority going to the preceeding entry
- *
- * Return value: The return enumerated type, or -1 if none are found
- **/
-gint
-pk_enum_list_contains_priority (PkEnumList *elist, gint value, ...)
-{
-	va_list args;
-	guint i;
-	guint value_temp;
-	gint retval = -1;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-
-	/* we must query at least one thing */
-	if (pk_enum_list_contains (elist, value)) {
-		return value;
-	}
-
-	/* process the valist */
-	va_start (args, value);
-	for (i=0;; i++) {
-		value_temp = va_arg (args, gint);
-		/* do we have this one? */
-		if (pk_enum_list_contains (elist, value_temp)) {
-			retval = value_temp;
-			break;
-		}
-		/* end of the list */
-		if (value_temp == -1) {
-			break;
-		}
-	}
-	va_end (args);
-
-	return retval;
-}
-
-/**
- * pk_enum_list_from_string:
- * @elist: a valid #PkEnumList instance
- * @enums: a text representation of the list, e.g. "search-name;search-details"
- *
- * Set the list with a seed string. Converting the seed string once allows us
- * to deal with raw enumerated integers, which is often much faster.
- *
- * Return value: %TRUE if we appended the data
- **/
-gboolean
-pk_enum_list_from_string (PkEnumList *elist, const gchar *enums)
-{
-	gchar **sections;
-	guint i;
-	guint value_temp = 0;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-
-	if (enums == NULL) {
-		pk_warning ("enums null");
-		return FALSE;
-	}
-
-	/* check if we have nothing */
-	if (pk_strequal (enums, "none")) {
-		pk_debug ("no values");
-		return TRUE;
-	}
-
-	/* split by delimeter ';' */
-	sections = g_strsplit (enums, ";", 0);
-	for (i=0; sections[i]; i++) {
-		if (elist->priv->type == PK_ENUM_LIST_TYPE_ROLE) {
-			value_temp = pk_role_enum_from_text (sections[i]);
-		} else if (elist->priv->type == PK_ENUM_LIST_TYPE_GROUP) {
-			value_temp = pk_group_enum_from_text (sections[i]);
-		} else if (elist->priv->type == PK_ENUM_LIST_TYPE_FILTER) {
-			value_temp = pk_filter_enum_from_text (sections[i]);
-		} else if (elist->priv->type == PK_ENUM_LIST_TYPE_STATUS) {
-			value_temp = pk_status_enum_from_text (sections[i]);
-		} else {
-			pk_error ("unknown type %i (did you use pk_enum_list_set_type?)", elist->priv->type);
-		}
-		g_ptr_array_add (elist->priv->data, GUINT_TO_POINTER(value_temp));
-	}
-	g_strfreev (sections);
-	return TRUE;
-}
-
-/**
- * pk_enum_list_get_item_text:
- **/
-static const gchar *
-pk_enum_list_get_item_text (PkEnumList *elist, guint value)
-{
-	const gchar *text = NULL;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), NULL);
-
-	if (elist->priv->type == PK_ENUM_LIST_TYPE_ROLE) {
-		text = pk_role_enum_to_text (value);
-	} else if (elist->priv->type == PK_ENUM_LIST_TYPE_GROUP) {
-		text = pk_group_enum_to_text (value);
-	} else if (elist->priv->type == PK_ENUM_LIST_TYPE_FILTER) {
-		text = pk_filter_enum_to_text (value);
-	} else if (elist->priv->type == PK_ENUM_LIST_TYPE_STATUS) {
-		text = pk_status_enum_to_text (value);
-	} else {
-		pk_warning ("unknown type %i (did you use pk_enum_list_set_type?)", elist->priv->type);
-	}
-	return text;
-}
-
-/**
- * pk_enum_list_to_string:
- * @elist: a valid #PkEnumList instance
- *
- * Converts the enumerated list back to a string.
- *
- * Return value: A string representing the enumerated list,
- *  e.g. "search-name;search-details"
- **/
-gchar *
-pk_enum_list_to_string (PkEnumList *elist)
-{
-	guint i;
-	GString *string;
-	guint value;
-	guint length;
-	const gchar *text = NULL;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), NULL);
-
-	length = elist->priv->data->len;
-	if (length == 0) {
-		return g_strdup ("none");
-	}
-
-	string = g_string_new ("");
-	for (i=0; i<length; i++) {
-		value = GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, i));
-		text = pk_enum_list_get_item_text (elist, value);
-		g_string_append (string, text);
-		g_string_append (string, ";");
-	}
-
-	/* remove last ';' */
-	g_string_set_size (string, string->len - 1);
-
-	return g_string_free (string, FALSE);
-}
-
-/**
- * pk_enum_list_print:
- * @elist: a valid #PkEnumList instance
- *
- * Prints the enumerated list. This is most useful for debugging.
- *
- * Return value: %TRUE for success.
- **/
-gboolean
-pk_enum_list_print (PkEnumList *elist)
-{
-	guint i;
-	guint value;
-	const gchar *text = NULL;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-
-	if (elist->priv->type == PK_ENUM_LIST_TYPE_ROLE) {
-		g_print ("Printing actions:\n");
-	} else if (elist->priv->type == PK_ENUM_LIST_TYPE_GROUP) {
-		g_print ("Printing groups:\n");
-	} else if (elist->priv->type == PK_ENUM_LIST_TYPE_FILTER) {
-		g_print ("Printing filters:\n");
-	} else if (elist->priv->type == PK_ENUM_LIST_TYPE_STATUS) {
-		g_print ("Printing status:\n");
-	}
-	for (i=0; i<elist->priv->data->len; i++) {
-		value = GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, i));
-		text = pk_enum_list_get_item_text (elist, value);
-		g_print ("%s\n", text);
-	}
-
-	return TRUE;
-}
-
-/**
- * pk_enum_list_size:
- * @elist: a valid #PkEnumList instance
- *
- * Return value: the size of the enumerated list.
- **/
-guint
-pk_enum_list_size (PkEnumList *elist)
-{
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), 0);
-	return elist->priv->data->len;
-}
-
-/**
- * pk_enum_list_get_item:
- * @elist: a valid #PkEnumList instance
- * @item: the item number of the list
- *
- * Return value: the enum value for this position, or zero if error.
- **/
-guint
-pk_enum_list_get_item (PkEnumList *elist, guint item)
-{
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), 0);
-	if (item >= elist->priv->data->len) {
-		pk_warning ("getting item over length");
-		return 0;
-	}
-	return GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, item));
-}
-
-/**
- * pk_enum_list_append:
- * @elist: a valid #PkEnumList instance
- * @value: the value to add
- *
- * Set a single item into a list.
- *
- * Return value: %TRUE if we set the data, %FALSE if it already existed
- **/
-gboolean
-pk_enum_list_append (PkEnumList *elist, guint value)
-{
-	guint i;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-
-	for (i=0; i<elist->priv->data->len; i++) {
-		if (GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, i)) == value) {
-			pk_debug ("trying to append item already in list");
-			return FALSE;
-		}
-	}
-	g_ptr_array_add (elist->priv->data, GUINT_TO_POINTER(value));
-	return TRUE;
-}
-
-/**
- * pk_enum_list_remove:
- * @elist: a valid #PkEnumList instance
- * @value: the value to add
- *
- * Removes a single item from a list.
- *
- * Return value: %TRUE if we set the data, %FALSE if it did not exist
- **/
-gboolean
-pk_enum_list_remove (PkEnumList *elist, guint value)
-{
-	guint i;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-
-	for (i=0; i<elist->priv->data->len; i++) {
-		if (GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, i)) == value) {
-			g_ptr_array_remove_index (elist->priv->data, i);
-			return TRUE;
-		}
-	}
-	pk_debug ("cannot find item '%s'", pk_enum_list_get_item_text (elist, value));
-	return FALSE;
-}
-
-/**
- * pk_enum_list_contains:
- * @elist: a valid #PkEnumList instance
- * @value: the value to search for
- *
- * Searches the list looking for a specific value.
- *
- * Return value: %TRUE if we found the data in the list
- **/
-gboolean
-pk_enum_list_contains (PkEnumList *elist, guint value)
-{
-	guint i;
-
-	g_return_val_if_fail (PK_IS_ENUM_LIST (elist), FALSE);
-
-	for (i=0; i<elist->priv->data->len; i++) {
-		if (GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, i)) == value) {
-			return TRUE;
-		}
-	}
-	return FALSE;
-}
-
-/**
- * pk_enum_list_class_init:
- **/
-static void
-pk_enum_list_class_init (PkEnumListClass *klass)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	object_class->finalize = pk_enum_list_finalize;
-	g_type_class_add_private (klass, sizeof (PkEnumListPrivate));
-}
-
-/**
- * pk_enum_list_init:
- **/
-static void
-pk_enum_list_init (PkEnumList *elist)
-{
-	elist->priv = PK_ENUM_LIST_GET_PRIVATE (elist);
-	elist->priv->data = g_ptr_array_new ();
-	elist->priv->type = PK_ENUM_LIST_TYPE_UNKNOWN;
-}
-
-/**
- * pk_enum_list_finalize:
- **/
-static void
-pk_enum_list_finalize (GObject *object)
-{
-	PkEnumList *elist;
-	g_return_if_fail (object != NULL);
-	g_return_if_fail (PK_IS_ENUM_LIST (object));
-	elist = PK_ENUM_LIST (object);
-	g_return_if_fail (elist->priv != NULL);
-
-	g_ptr_array_free (elist->priv->data, TRUE);
-
-	G_OBJECT_CLASS (pk_enum_list_parent_class)->finalize (object);
-}
-
-/**
- * pk_enum_list_new:
- **/
-PkEnumList *
-pk_enum_list_new (void)
-{
-	PkEnumList *elist;
-	elist = g_object_new (PK_TYPE_ENUM_LIST, NULL);
-	return PK_ENUM_LIST (elist);
-}
-
-/***************************************************************************
- ***                          MAKE CHECK TESTS                           ***
- ***************************************************************************/
-#ifdef PK_BUILD_TESTS
-#include <libselftest.h>
-
-void
-libst_enum_list (LibSelfTest *test)
-{
-	PkEnumList *elist;
-	gboolean ret;
-	gchar *text;
-	guint value;
-
-	if (libst_start (test, "PkEnumList", CLASS_AUTO) == FALSE) {
-		return;
-	}
-
-	/************************************************************
-	 ****************          ENUM         ******************
-	 ************************************************************/
-	libst_title (test, "get a new PkEnumList object");
-	elist = pk_enum_list_new ();
-	if (elist != NULL) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "set action builder");
-	ret = pk_enum_list_set_type (elist, PK_ENUM_LIST_TYPE_ROLE);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "get empty list");
-	text = pk_enum_list_to_string (elist);
-	if (pk_strequal (text, "none")) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid '%s', should be 'none'", text);
-	}
-	g_free (text);
-
-	/************************************************************/
-	libst_title (test, "get empty size");
-	value = pk_enum_list_size (elist);
-	if (value == 0) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid size %i, should be 0", value);
-	}
-
-	/************************************************************/
-	libst_title (test, "append single");
-	ret = pk_enum_list_append (elist, PK_ROLE_ENUM_SEARCH_NAME);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "append duplicate");
-	ret = pk_enum_list_append (elist, PK_ROLE_ENUM_SEARCH_NAME);
-	if (!ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "get single size");
-	value = pk_enum_list_size (elist);
-	if (value == 1) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid size %i, should be 1", value);
-	}
-
-	/************************************************************/
-	libst_title (test, "check item");
-	value = pk_enum_list_get_item (elist, 0);
-	if (value == PK_ROLE_ENUM_SEARCH_NAME) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid item %i, should be PK_ROLE_ENUM_SEARCH_NAME", value);
-	}
-
-	/************************************************************/
-	libst_title (test, "get single list");
-	text = pk_enum_list_to_string (elist);
-	if (pk_strequal (text, "search-name")) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid '%s', should be 'search-name'", text);
-	}
-	g_free (text);
-
-	/************************************************************/
-	libst_title (test, "add multiple");
-	ret = pk_enum_list_append_multiple (elist, PK_ROLE_ENUM_SEARCH_DETAILS, PK_ROLE_ENUM_SEARCH_GROUP, -1);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "get multiple size");
-	value = pk_enum_list_size (elist);
-	if (value == 3) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid size %i, should be 3", value);
-	}
-
-
-	/************************************************************/
-	libst_title (test, "priority check missing");
-	value = pk_enum_list_contains_priority (elist, PK_ROLE_ENUM_SEARCH_FILE, -1);
-	if (value == -1) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "returned priority %i when should be missing", value);
-	}
-
-	/************************************************************/
-	libst_title (test, "priority check first");
-	value = pk_enum_list_contains_priority (elist, PK_ROLE_ENUM_SEARCH_GROUP, -1);
-	if (value == PK_ROLE_ENUM_SEARCH_GROUP) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "returned wrong value; %i", value);
-	}
-
-	/************************************************************/
-	libst_title (test, "priority check second, correct");
-	value = pk_enum_list_contains_priority (elist, PK_ROLE_ENUM_SEARCH_FILE, PK_ROLE_ENUM_SEARCH_GROUP, -1);
-	if (value == PK_ROLE_ENUM_SEARCH_GROUP) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "returned wrong value; %i", value);
-	}
-
-	/************************************************************/
-	libst_title (test, "get multiple list");
-	text = pk_enum_list_to_string (elist);
-	if (pk_strequal (text, "search-name;search-details;search-group")) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid '%s', should be 'search-name;search-details;search-group'", text);
-	}
-	g_free (text);
-
-	/************************************************************/
-	libst_title (test, "remove single");
-	ret = pk_enum_list_remove (elist, PK_ROLE_ENUM_SEARCH_DETAILS);
-	if (ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "remove duplicate single");
-	ret = pk_enum_list_remove (elist, PK_ROLE_ENUM_SEARCH_DETAILS);
-	if (!ret) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, NULL);
-	}
-
-	/************************************************************/
-	libst_title (test, "get size after remove");
-	value = pk_enum_list_size (elist);
-	if (value == 2) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid size %i, should be 2", value);
-	}
-
-	g_object_unref (elist);
-
-	/************************************************************/
-	libst_title (test, "set none enum list");
-	elist = pk_enum_list_new ();
-	pk_enum_list_set_type (elist, PK_ENUM_LIST_TYPE_ROLE);
-	pk_enum_list_from_string (elist, "none");
-	if (elist->priv->data->len == 0) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid length %i", elist->priv->data->len);
-	}
-
-	/************************************************************/
-	libst_title (test, "get none enum list");
-	text = pk_enum_list_to_string (elist);
-	if (pk_strequal (text, "none")) {
-		libst_success (test, NULL);
-	} else {
-		libst_failed (test, "invalid '%s', should be 'none'", text);
-	}
-	g_free (text);
-
-
-	g_object_unref (elist);
-	libst_end (test);
-}
-#endif
-
diff --git a/libpackagekit/pk-enum-list.h b/libpackagekit/pk-enum-list.h
deleted file mode 100644
index 4104019..0000000
--- a/libpackagekit/pk-enum-list.h
+++ /dev/null
@@ -1,85 +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_ENUM_LIST_H
-#define __PK_ENUM_LIST_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_ENUM_LIST		(pk_enum_list_get_type ())
-#define PK_ENUM_LIST(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_ENUM_LIST, PkEnumList))
-#define PK_ENUM_LIST_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_ENUM_LIST, PkEnumListClass))
-#define PK_IS_ENUM_LIST(o)	 	(G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_ENUM_LIST))
-#define PK_IS_ENUM_LIST_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_ENUM_LIST))
-#define PK_ENUM_LIST_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_ENUM_LIST, PkEnumListClass))
-
-typedef struct _PkEnumListPrivate	PkEnumListPrivate;
-typedef struct _PkEnumList		PkEnumList;
-typedef struct _PkEnumListClass		PkEnumListClass;
-
-struct _PkEnumList
-{
-	GObject			 parent;
-	PkEnumListPrivate	*priv;
-};
-
-struct _PkEnumListClass
-{
-	GObjectClass	parent_class;
-};
-
-typedef enum {
-	PK_ENUM_LIST_TYPE_ROLE,
-	PK_ENUM_LIST_TYPE_GROUP,
-	PK_ENUM_LIST_TYPE_FILTER,
-	PK_ENUM_LIST_TYPE_STATUS,
-	PK_ENUM_LIST_TYPE_UNKNOWN
-} PkEnumListType;
-
-GType		 pk_enum_list_get_type			(void) G_GNUC_CONST;
-PkEnumList	*pk_enum_list_new			(void);
-
-gboolean	 pk_enum_list_set_type			(PkEnumList	*elist,
-							 PkEnumListType	 type);
-gboolean	 pk_enum_list_from_string		(PkEnumList	*elist,
-							 const gchar	*enums);
-gchar		*pk_enum_list_to_string			(PkEnumList	*elist)
-							 G_GNUC_WARN_UNUSED_RESULT;
-guint		 pk_enum_list_size			(PkEnumList	*elist);
-guint		 pk_enum_list_get_item			(PkEnumList	*elist,
-							 guint		 item);
-gboolean	 pk_enum_list_contains			(PkEnumList	*elist,
-							 guint		 value);
-gint		 pk_enum_list_contains_priority		(PkEnumList	*elist,
-							 gint		 value, ...);
-gboolean	 pk_enum_list_append			(PkEnumList	*elist,
-							 guint		 value);
-gboolean	 pk_enum_list_remove			(PkEnumList	*elist,
-							 guint		 value);
-gboolean	 pk_enum_list_print			(PkEnumList	*elist);
-gboolean	 pk_enum_list_append_multiple		(PkEnumList	*elist,
-							 gint		 value, ...);
-
-G_END_DECLS
-
-#endif /* __PK_ENUM_LIST_H */
diff --git a/libpackagekit/pk-extra.h b/libpackagekit/pk-extra.h
index c3b82c0..c1c2f96 100644
--- a/libpackagekit/pk-extra.h
+++ b/libpackagekit/pk-extra.h
@@ -24,7 +24,6 @@
 
 #include <glib-object.h>
 #include "pk-enum.h"
-#include "pk-enum-list.h"
 #include "pk-package-list.h"
 
 G_BEGIN_DECLS
diff --git a/src/pk-backend-dbus.h b/src/pk-backend-dbus.h
index 9ab9995..4e0eff3 100644
--- a/src/pk-backend-dbus.h
+++ b/src/pk-backend-dbus.h
@@ -23,7 +23,6 @@
 #define __PK_BACKEND_DBUS_H
 
 #include <glib-object.h>
-#include <pk-enum-list.h>
 #include "pk-backend.h"
 
 G_BEGIN_DECLS
diff --git a/src/pk-backend-thread.h b/src/pk-backend-thread.h
index 9fe6260..d7b4f30 100644
--- a/src/pk-backend-thread.h
+++ b/src/pk-backend-thread.h
@@ -23,7 +23,6 @@
 #define __PK_BACKEND_THREAD_H
 
 #include <glib-object.h>
-#include <pk-enum-list.h>
 
 #include "pk-backend-internal.h"
 #include "pk-backend-thread.h"
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 0533033..a51614a 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -25,7 +25,6 @@
 #include <glib.h>
 #include <gmodule.h>
 #include <pk-enum.h>
-#include <pk-enum-list.h>
 #include <pk-package-id.h>
 #include <pk-debug.h>
 
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 908b783..50cb738 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -25,7 +25,6 @@
 #include <glib-object.h>
 #include <dbus/dbus-glib.h>
 
-#include <pk-enum-list.h>
 #include <pk-enum.h>
 #include <pk-package-list.h>
 
commit 142d6954f8aae3ab9494747a55af5952d715921a
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 11:44:55 2008 +0100

    add another convenience helper

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index cd6fff9..6bfc8f6 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -1092,7 +1092,7 @@ libst_enum (LibSelfTest *test)
 
 	/************************************************************/
 	libst_title (test, "check we convert all the role enums");
-	for (i=0; i<=PK_ROLE_ENUM_UNKNOWN; i++) {
+	for (i=1; i<=PK_ROLE_ENUM_UNKNOWN; i*=2) {
 		string = pk_role_enum_to_text (i);
 		if (string == NULL) {
 			libst_failed (test, "failed to get %i", i);
@@ -1158,7 +1158,7 @@ libst_enum (LibSelfTest *test)
 
 	/************************************************************/
 	libst_title (test, "check we convert all the group enums");
-	for (i=0; i<=PK_GROUP_ENUM_UNKNOWN; i++) {
+	for (i=1; i<=PK_GROUP_ENUM_UNKNOWN; i*=2) {
 		string = pk_group_enum_to_text (i);
 		if (string == NULL) {
 			libst_failed (test, "failed to get %i", i);
@@ -1293,6 +1293,21 @@ libst_enum (LibSelfTest *test)
 	g_free (text);
 
 	/************************************************************/
+	libst_title (test, "check we can test enum presence");
+	filter = PK_FILTER_ENUM_NOT_DEVELOPMENT | PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_NEWEST;
+	if (pk_enums_contain (filter, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "wrong boolean");
+	}
+	libst_title (test, "check we can test enum false-presence");
+	if (!pk_enums_contain (filter, PK_FILTER_ENUM_FREE)) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "wrong boolean");
+	}
+
+	/************************************************************/
 	libst_title (test, "check we can add / remove enums to nothing");
 	filter = PK_FILTER_ENUM_NOT_DEVELOPMENT;
 	pk_enums_remove (filter, PK_FILTER_ENUM_NOT_DEVELOPMENT);
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 1091a01..5993403 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -40,6 +40,7 @@ typedef struct {
 /* convenience functions as it's easy to forget the bitwise operators */
 #define pk_enums_add(enums,enum)	do { ((enums) |= (enum)); } while (0)
 #define pk_enums_remove(enums,enum)	do { ((enums) &= ~(enum)); } while (0)
+#define pk_enums_contain(enums,enum)	(((enums) & (enum)) > 0)
 
 /**
  * PkRoleEnum:
commit 3c95c5f62fb0d4360a8f30df741ff0725feb36d9
Merge: f89390f... de4f88c...
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 11:31:56 2008 +0100

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

commit f89390f2c2fb9017da67442935b31624a24da834
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 11:31:38 2008 +0100

    convert two backends to enums that i missed yesterday

diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index e10179d..9e42182 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -711,19 +711,11 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
 	pk_backend_finished (backend);
 }
 
-static PkGroupEnum
-backend_get_groups (PkBackend *backend)
+static PkFilterEnum
+backend_get_filters (PkBackend *backend)
 {
-  list = pk_enum_list_new ();
-  pk_enum_list_set_type (list, PK_ENUM_LIST_TYPE_GROUP);
-}
-
-static void
-backend_get_filters (PkBackend *backend, PkEnumList *list)
-{
-  list = pk_enum_list_new ();
-  pk_enum_list_set_type (list, PK_ENUM_LIST_TYPE_FILTER);
-  pk_enum_list_append (list, PK_FILTER_ENUM_INSTALLED);
+	g_return_val_if_fail (backend != NULL, PK_FILTER_ENUM_UNKNOWN);
+	return PK_FILTER_ENUM_INSTALLED;
 }
 
 static void
@@ -793,7 +785,6 @@ PK_BACKEND_OPTIONS (
 	"Andreas Obergrusberger <tradiaz at yahoo.de>",	/* author */
 	backend_initialize,				/* initialize */
 	backend_destroy,				/* destroy */
-	backend_get_groups,				/* get_groups */
 	backend_get_filters,				/* get_filters */
 	NULL,						/* cancel */
  	NULL,						/* get_depends */
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 72c228d..305f47f 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -571,15 +571,13 @@ backend_destroy (PkBackend *backend)
 /**
  * backend_get_filters:
  */
-static void
-backend_get_filters (PkBackend *backend, PkEnumList *elist)
+static PkFilterEnum
+backend_get_filters (PkBackend *backend)
 {
-	g_return_if_fail (backend != NULL);
-	pk_enum_list_append_multiple (elist,
-				      PK_FILTER_ENUM_GUI,
-				      PK_FILTER_ENUM_INSTALLED,
-				      PK_FILTER_ENUM_DEVELOPMENT,
-				      -1);
+	g_return_val_if_fail (backend != NULL, PK_FILTER_ENUM_UNKNOWN);
+	return (PK_FILTER_ENUM_GUI |
+		PK_FILTER_ENUM_INSTALLED |
+		PK_FILTER_ENUM_DEVELOPMENT);
 }
 
 /**
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 442ae56..b7823d8 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -1132,18 +1132,14 @@ backend_destroy (PkBackend *backend)
 /**
  * backend_get_filters:
  */
-static void
-backend_get_filters (PkBackend *backend, PkEnumList *elist)
+static PkFilterEnum
+backend_get_filters (PkBackend *backend)
 {
-	g_return_if_fail (backend != NULL);
-
-	pk_enum_list_append_multiple (elist,
-				      PK_FILTER_ENUM_DEVELOPMENT,
-				      PK_FILTER_ENUM_GUI,
-				      PK_FILTER_ENUM_INSTALLED,
-				      PK_FILTER_ENUM_NEWEST,
-				    /* PK_FILTER_ENUM_FREE, */
-				      -1);
+	g_return_val_if_fail (backend != NULL, PK_FILTER_ENUM_UNKNOWN);
+	return (PK_FILTER_ENUM_NEWEST |
+		PK_FILTER_ENUM_GUI |
+		PK_FILTER_ENUM_INSTALLED |
+		PK_FILTER_ENUM_DEVELOPMENT);
 }
 
 /**
commit 581de0924ca1ffa3b9e262c2cc8027f3752352e2
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 11:13:13 2008 +0100

    add text->enums functionality

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 565f817..cd6fff9 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -650,6 +650,37 @@ pk_role_enums_to_text (PkRoleEnum roles)
 }
 
 /**
+ * pk_role_enums_from_text:
+ * @roles: the enumerated constant value, e.g. "available;~gui"
+ *
+ * Converts text representation to its enumerated type bitfield
+ *
+ * Return value: The enumerated type values
+ **/
+PkRoleEnum
+pk_role_enums_from_text (const gchar *roles)
+{
+	PkRoleEnum roles_enum = 0;
+	gchar **split;
+	guint length;
+	guint i;
+
+	split = g_strsplit (roles, ";", 0);
+	if (split == NULL) {
+		pk_warning ("unable to split");
+		goto out;
+	}
+
+	length = g_strv_length (split);
+	for (i=0; i<length; i++) {
+		roles_enum += pk_role_enum_from_text (split[i]);
+	}
+out:
+	g_strfreev (split);
+	return roles_enum;
+}
+
+/**
  * pk_error_enum_from_text:
  * @code: Text describing the enumerated type
  *
@@ -763,7 +794,7 @@ pk_group_enum_to_text (PkGroupEnum group)
 
 /**
  * pk_groups_enums_to_text:
- * @filters: The enumerated type values
+ * @groups: The enumerated type values
  *
  * Converts a enumerated type bitfield to its text representation
  *
@@ -794,6 +825,37 @@ pk_group_enums_to_text (PkGroupEnum groups)
 }
 
 /**
+ * pk_group_enums_from_text:
+ * @groups: the enumerated constant value, e.g. "available;~gui"
+ *
+ * Converts text representation to its enumerated type bitfield
+ *
+ * Return value: The enumerated type values
+ **/
+PkGroupEnum
+pk_group_enums_from_text (const gchar *groups)
+{
+	PkGroupEnum groups_enum = 0;
+	gchar **split;
+	guint length;
+	guint i;
+
+	split = g_strsplit (groups, ";", 0);
+	if (split == NULL) {
+		pk_warning ("unable to split");
+		goto out;
+	}
+
+	length = g_strv_length (split);
+	for (i=0; i<length; i++) {
+		groups_enum += pk_group_enum_from_text (split[i]);
+	}
+out:
+	g_strfreev (split);
+	return groups_enum;
+}
+
+/**
  * pk_freq_enum_from_text:
  * @freq: Text describing the enumerated type
  *
@@ -915,6 +977,37 @@ pk_filter_enums_to_text (PkFilterEnum filters)
 }
 
 /**
+ * pk_filter_enums_from_text:
+ * @filters: the enumerated constant value, e.g. "available;~gui"
+ *
+ * Converts text representation to its enumerated type bitfield
+ *
+ * Return value: The enumerated type values
+ **/
+PkFilterEnum
+pk_filter_enums_from_text (const gchar *filters)
+{
+	PkFilterEnum filters_enum = PK_FILTER_ENUM_NONE;
+	gchar **split;
+	guint length;
+	guint i;
+
+	split = g_strsplit (filters, ";", 0);
+	if (split == NULL) {
+		pk_warning ("unable to split");
+		goto out;
+	}
+
+	length = g_strv_length (split);
+	for (i=0; i<length; i++) {
+		filters_enum += pk_filter_enum_from_text (split[i]);
+	}
+out:
+	g_strfreev (split);
+	return filters_enum;
+}
+
+/**
  * pk_license_enum_from_text:
  * @license: Text describing the enumerated type
  *
@@ -1160,6 +1253,33 @@ libst_enum (LibSelfTest *test)
 	g_free (text);
 
 	/************************************************************/
+	libst_title (test, "check we can convert filter text to enums (none)");
+	filter = pk_filter_enums_from_text ("none");
+	if (filter == PK_FILTER_ENUM_NONE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "filter was %i", i);
+	}
+
+	/************************************************************/
+	libst_title (test, "check we can convert filter text to enums (single)");
+	filter = pk_filter_enums_from_text ("~devel");
+	if (filter == PK_FILTER_ENUM_NOT_DEVELOPMENT) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "filter was %i", i);
+	}
+
+	/************************************************************/
+	libst_title (test, "check we can convert filter text to enums (plural)");
+	filter = pk_filter_enums_from_text ("~devel;gui;newest");
+	if (filter == (PK_FILTER_ENUM_NOT_DEVELOPMENT | PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_NEWEST)) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "filter was %i", i);
+	}
+
+	/************************************************************/
 	libst_title (test, "check we can add / remove enums");
 	filter = PK_FILTER_ENUM_NOT_DEVELOPMENT | PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_NEWEST;
 	pk_enums_add (filter, PK_FILTER_ENUM_NOT_FREE);
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 9b26f47..1091a01 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -489,6 +489,7 @@ const gchar	*pk_status_enum_to_text			(PkStatusEnum	 status);
 
 PkRoleEnum	 pk_role_enum_from_text			(const gchar	*role);
 const gchar	*pk_role_enum_to_text			(PkRoleEnum	 role);
+PkRoleEnum	 pk_role_enums_from_text 		(const gchar	*roles);
 gchar		*pk_role_enums_to_text			(PkRoleEnum	 roles);
 
 PkErrorCodeEnum	 pk_error_enum_from_text		(const gchar	*code);
@@ -502,10 +503,12 @@ const gchar	*pk_message_enum_to_text		(PkMessageEnum	 message);
 
 PkGroupEnum	 pk_group_enum_from_text		(const gchar	*group);
 const gchar	*pk_group_enum_to_text			(PkGroupEnum	 group);
+PkGroupEnum	 pk_group_enums_from_text 		(const gchar	*groups);
 gchar		*pk_group_enums_to_text			(PkGroupEnum	 groups);
 
 PkFilterEnum	 pk_filter_enum_from_text		(const gchar	*filter);
 const gchar	*pk_filter_enum_to_text			(PkFilterEnum	 filter);
+PkFilterEnum	 pk_filter_enums_from_text 		(const gchar	*filters);
 gchar		*pk_filter_enums_to_text		(PkFilterEnum	 filters);
 
 PkProvidesEnum	 pk_provides_enum_from_text		(const gchar	*provides);
commit de4f88c06a12474f8387e70aacec1d70e834bc8c
Author: Stefan Haas <shaas at suse.de>
Date:   Fri Apr 11 11:58:36 2008 +0200

    rearrange groups and make it compile again

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 36e243c..f12a1a3 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -334,24 +334,24 @@ static PkGroupEnum
 backend_get_groups (PkBackend *backend)
 {
 	g_return_val_if_fail (backend != NULL, PK_GROUP_ENUM_UNKNOWN);
-	return (PK_GROUP_ENUM_GAMES |
-	        PK_GROUP_ENUM_GRAPHICS |
-	        PK_GROUP_ENUM_OFFICE |
-	        PK_GROUP_ENUM_PROGRAMMING |
-	        PK_GROUP_ENUM_MULTIMEDIA |
-	        PK_GROUP_ENUM_SYSTEM |
-	        PK_GROUP_ENUM_DESKTOP_GNOME |
-	        PK_GROUP_ENUM_DESKTOP_KDE |
-	        PK_GROUP_ENUM_DESKTOP_XFCE |
-	        PK_GROUP_ENUM_DESKTOP_OTHER |
-	        PK_GROUP_ENUM_PUBLISHING |
-	        PK_GROUP_ENUM_ADMIN_TOOLS |
-	        PK_GROUP_ENUM_LOCALIZATION |
-	        PK_GROUP_ENUM_SECURITY |
-	        PK_GROUP_ENUM_EDUCATION |
-	        PK_GROUP_ENUM_COMMUNICATION |
-	        PK_GROUP_ENUM_NETWORK |
-	        PK_GROUP_ENUM_UNKNOWN);
+	return (PkGroupEnum)(PK_GROUP_ENUM_ADMIN_TOOLS |
+			PK_GROUP_ENUM_COMMUNICATION |
+			PK_GROUP_ENUM_DESKTOP_GNOME |
+		        PK_GROUP_ENUM_DESKTOP_KDE |
+		        PK_GROUP_ENUM_DESKTOP_OTHER |
+			PK_GROUP_ENUM_DESKTOP_XFCE |
+			PK_GROUP_ENUM_EDUCATION |
+			PK_GROUP_ENUM_GAMES |
+			PK_GROUP_ENUM_GRAPHICS |
+			PK_GROUP_ENUM_LOCALIZATION |
+			PK_GROUP_ENUM_MULTIMEDIA |
+			PK_GROUP_ENUM_NETWORK |
+			PK_GROUP_ENUM_OFFICE |
+			PK_GROUP_ENUM_PROGRAMMING |
+			PK_GROUP_ENUM_PUBLISHING |
+			PK_GROUP_ENUM_SECURITY |
+			PK_GROUP_ENUM_SYSTEM |
+			PK_GROUP_ENUM_UNKNOWN);
 }
 
 /**


More information about the PackageKit-commit mailing list