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

Richard Hughes hughsient at kemper.freedesktop.org
Fri Oct 12 12:14:25 PDT 2007


 client/pk-console.c          |   10 +++++++++
 libpackagekit/pk-enum-list.c |   45 ++++++++++++++++++++++++-------------------
 2 files changed, 36 insertions(+), 19 deletions(-)

New commits:
diff-tree 07ea4af627cf09656c9b9c885553fb943e645446 (from 0de579da06eb44c3f68ad0b860a76a61225248b5)
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Oct 12 20:13:16 2007 +0100

    abstract out the text getting so we can see what we are not removing, if you see what i mean

diff --git a/libpackagekit/pk-enum-list.c b/libpackagekit/pk-enum-list.c
index 2319e87..e8738e1 100644
--- a/libpackagekit/pk-enum-list.c
+++ b/libpackagekit/pk-enum-list.c
@@ -134,6 +134,29 @@ pk_enum_list_from_string (PkEnumList *el
 }
 
 /**
+ * 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 (elist != NULL, 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 {
+		pk_warning ("unknown type %i (did you use pk_enum_list_set_type?)", elist->priv->type);
+	}
+	return text;
+}
+
+/**
  * pk_enum_list_to_string:
  **/
 gchar *
@@ -156,15 +179,7 @@ pk_enum_list_to_string (PkEnumList *elis
 	string = g_string_new ("");
 	for (i=0; i<length; i++) {
 		value = GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, i));
-		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 {
-			pk_error ("unknown type %i (did you use pk_enum_list_set_type?)", elist->priv->type);
-		}
+		text = pk_enum_list_get_item_text (elist, value);
 		g_string_append (string, text);
 		g_string_append (string, ";");
 	}
@@ -197,15 +212,7 @@ pk_enum_list_print (PkEnumList *elist)
 	}
 	for (i=0; i<elist->priv->data->len; i++) {
 		value = GPOINTER_TO_UINT (g_ptr_array_index (elist->priv->data, i));
-		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 {
-			pk_error ("unknown type %i (did you use pk_enum_list_set_type?)", elist->priv->type);
-		}
+		text = pk_enum_list_get_item_text (elist, value);
 		g_print ("%s\n", text);
 	}
 
@@ -276,7 +283,7 @@ pk_enum_list_remove (PkEnumList *elist, 
 			return TRUE;
 		}
 	}
-	pk_debug ("cannot find item %i", value);
+	pk_debug ("cannot find item '%s'", pk_enum_list_get_item_text (elist, value));
 	return FALSE;
 }
 
diff-tree 0de579da06eb44c3f68ad0b860a76a61225248b5 (from 8edae6a0d76b2c7d8fee1a7a2df7091d9c00b4ba)
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Thu Oct 11 11:16:06 2007 -0400

    Implement update for pkcon

diff --git a/client/pk-console.c b/client/pk-console.c
index e35fbbd..14457b1 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -273,6 +273,16 @@ pk_console_parse_multiple_commands (PkCl
 			pk_client_wait ();
 			remove = 2;
 		}
+	} else if (strcmp (mode, "update") == 0) {
+		if (value == NULL) {
+			pk_console_usage ("you need to specify a package to update");
+			remove = 1;
+			goto out;
+		} else {
+			pk_client_update_package (client, value);
+			pk_client_wait ();
+			remove = 2;
+		}
 	} else if (strcmp (mode, "resolve") == 0) {
 		if (value == NULL) {
 			pk_console_usage ("you need to specify a package name to resolve");



More information about the PackageKit mailing list