[gnome-packagekit/glib2: 22/79] mo



commit 65c1b9d4e1e3d93a0424455c2249b00d16cebb92
Author: Richard Hughes <richard hughsie com>
Date:   Thu Sep 17 11:10:20 2009 +0100

    mo

 src/gpk-application.c   |   18 +-
 src/gpk-check-update.c  |  656 +++++++++++++++++++++++------------------------
 src/gpk-dbus-task.c     |   20 +-
 src/gpk-update-viewer.c |   26 +-
 src/gpk-watch.c         |    2 +-
 5 files changed, 352 insertions(+), 370 deletions(-)
---
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 05321c9..ee02d59 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -996,7 +996,7 @@ gpk_application_add_item_to_results (GpkApplication *application, const PkItemPa
 
 	/* are we in the package list? */
 	in_queue = pk_package_list_contains (application->priv->package_list, item->package_id);
-	installed = (item->info_enum == PK_INFO_ENUM_INSTALLED) || (item->info == PK_INFO_ENUM_COLLECTION_INSTALLED);
+	installed = (item->info == PK_INFO_ENUM_INSTALLED) || (item->info == PK_INFO_ENUM_COLLECTION_INSTALLED);
 
 	if (installed)
 		pk_bitfield_add (state, GPK_STATE_INSTALLED);
@@ -1004,7 +1004,7 @@ gpk_application_add_item_to_results (GpkApplication *application, const PkItemPa
 		pk_bitfield_add (state, GPK_STATE_IN_LIST);
 
 	/* special icon */
-	if (item->info_enum == PK_INFO_ENUM_COLLECTION_INSTALLED || item->info == PK_INFO_ENUM_COLLECTION_AVAILABLE)
+	if (item->info == PK_INFO_ENUM_COLLECTION_INSTALLED || item->info == PK_INFO_ENUM_COLLECTION_AVAILABLE)
 		pk_bitfield_add (state, GPK_STATE_COLLECTION);
 
 	/* use the application icon if available */
@@ -1067,8 +1067,8 @@ gpk_application_package_cb (PkClient *client, const PkItemPackage *item, GpkAppl
 		return;
 
 	/* ignore progress */
-	if (item->info_enum != PK_INFO_ENUM_INSTALLED && item->info != PK_INFO_ENUM_AVAILABLE &&
-	    item->info_enum != PK_INFO_ENUM_COLLECTION_INSTALLED && item->info != PK_INFO_ENUM_COLLECTION_AVAILABLE)
+	if (item->info != PK_INFO_ENUM_INSTALLED && item->info != PK_INFO_ENUM_AVAILABLE &&
+	    item->info != PK_INFO_ENUM_COLLECTION_INSTALLED && item->info != PK_INFO_ENUM_COLLECTION_AVAILABLE)
 		return;
 
 	/* add to list */
@@ -1336,7 +1336,7 @@ gpk_application_run_installed (GpkApplication *application)
 	len = list->len;
 	for (i=0; i<len; i++) {
 		item = g_ptr_array_index (list, i);
-		if (item->info_enum == PK_INFO_ENUM_INSTALLING)
+		if (item->info == PK_INFO_ENUM_INSTALLING)
 			g_ptr_array_add (array, g_strdup (item->package_id));
 	}
 
@@ -1347,7 +1347,7 @@ gpk_application_run_installed (GpkApplication *application)
 	}
 
 	/* this is async */
-	package_ids = pk_package_ids_from_array (array);
+	package_ids = pk_ptr_array_to_strv (array);
 	gpk_helper_run_show (application->priv->helper_run, package_ids);
 
 out:
@@ -1517,7 +1517,7 @@ gpk_application_cancel_cb (GtkWidget *button_widget, GpkApplication *application
 
 	g_return_if_fail (GPK_IS_APPLICATION (application));
 
-	ret = pk_client_cancel (application->priv->client_primary, NULL);
+	ret = g_cancellable_cancel (application->priv->client_primary, NULL);
 	egg_debug ("canceled? %i", ret);
 
 	/* switch buttons around */
@@ -1736,13 +1736,13 @@ gpk_application_quit (GpkApplication *application)
 	}
 
 	/* we might have visual stuff running, close them down */
-	ret = pk_client_cancel (application->priv->client_primary, &error);
+	ret = g_cancellable_cancel (application->priv->client_primary, &error);
 	if (!ret) {
 		egg_warning ("failed to cancel client: %s", error->message);
 		g_error_free (error);
 		error = NULL;
 	}
-	ret = pk_client_cancel (application->priv->client_secondary, &error);
+	ret = g_cancellable_cancel (application->priv->client_secondary, &error);
 	if (!ret) {
 		egg_warning ("failed to cancel client: %s", error->message);
 		g_error_free (error);
diff --git a/src/gpk-check-update.c b/src/gpk-check-update.c
index 7c4b743..59f45b9 100644
--- a/src/gpk-check-update.c
+++ b/src/gpk-check-update.c
@@ -53,6 +53,7 @@
 #include "gpk-helper-repo-signature.h"
 
 static void     gpk_check_update_finalize	(GObject	     *object);
+static void	gpk_check_update_libnotify_cb (NotifyNotification *notification, gchar *action, gpointer data);
 
 #define GPK_CHECK_UPDATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_CHECK_UPDATE, GpkCheckUpdatePrivate))
 
@@ -80,6 +81,7 @@ struct GpkCheckUpdatePrivate
 	GPtrArray		*important_updates_array;
 	EggDbusMonitor		*dbus_monitor_viewer;
 	guint			 updates_changed_id;
+	GCancellable		*cancellable;
 };
 
 G_DEFINE_TYPE (GpkCheckUpdate, gpk_check_update, G_TYPE_OBJECT)
@@ -319,7 +321,7 @@ gpk_check_update_popup_menu_cb (GtkStatusIcon *status_icon, guint button, guint3
 		gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
 }
 
-static gboolean gpk_check_update_query_updates (GpkCheckUpdate *cupdate, gboolean policy_action);
+static void gpk_check_update_query_updates (GpkCheckUpdate *cupdate);
 
 /**
  * gpk_check_update_get_updates_post_update_cb:
@@ -332,30 +334,155 @@ gpk_check_update_get_updates_post_update_cb (GpkCheckUpdate *cupdate)
 	/* debug so we can catch polling */
 	egg_debug ("post updates check");
 
-	gpk_check_update_query_updates (cupdate, FALSE);
+	gpk_check_update_query_updates (cupdate);
 	return FALSE;
 }
 
+
 /**
- * gpk_check_update_update_system:
+ * gpk_check_update_finished_notify:
  **/
-static gboolean
-gpk_check_update_update_system (GpkCheckUpdate *cupdate)
+static void
+gpk_check_update_finished_notify (GpkCheckUpdate *cupdate, PkResults *results)
 {
 	gboolean ret;
 	GError *error = NULL;
+	NotifyNotification *notification;
+	PkRestartEnum restart;
+	guint i;
+	GPtrArray *array;
+	const PkItemPackage *item;
+	GString *message_text = NULL;
+	guint skipped_number = 0;
+	const gchar *message;
+	gchar **split;
+
+	/* check we got some packages */
+	array = pk_results_get_package_array (results);
+	egg_debug ("length=%i", array->len);
+	if (array->len == 0) {
+		egg_debug ("no updates");
+		goto out;
+	}
+
+	message_text = g_string_new ("");
+
+	/* find any we skipped */
+	for (i=0; i<array->len; i++) {
+		item = g_ptr_array_index (array, i);
 
-	ret = pk_client_update_system (cupdate->priv->client, &error);
+		split = pk_package_id_split (item->package_id);
+		egg_debug ("%s, %s, %s", pk_info_enum_to_text (item->info),
+			   split[PK_PACKAGE_ID_NAME], item->summary);
+		if (item->info == PK_INFO_ENUM_BLOCKED) {
+			skipped_number++;
+			g_string_append_printf (message_text, "<b>%s</b> - %s\n",
+						split[PK_PACKAGE_ID_NAME], item->summary);
+		}
+		g_strfreev (split);
+	}
+	g_object_unref (array);
+
+	/* notify the user if there were skipped entries */
+	if (skipped_number > 0) {
+		/* TRANSLATORS: we did the update, but some updates were skipped and not applied */
+		message = ngettext ("One package was skipped:",
+				    "Some packages were skipped:", skipped_number);
+		g_string_prepend (message_text, message);
+		g_string_append_c (message_text, '\n');
+	}
+
+	/* add a message that we need to restart */
+	restart = pk_results_get_require_restart_worst (results);
+	if (restart != PK_RESTART_ENUM_NONE) {
+		message = gpk_restart_enum_to_localised_text (restart);
+
+		/* add a gap if we are putting both */
+		if (skipped_number > 0)
+			g_string_append (message_text, "\n");
+
+		g_string_append (message_text, message);
+		g_string_append_c (message_text, '\n');
+	}
+
+	/* trim off extra newlines */
+	if (message_text->len != 0)
+		g_string_set_size (message_text, message_text->len-1);
+
+	/* do we do the notification? */
+	ret = gconf_client_get_bool (cupdate->priv->gconf_client, GPK_CONF_NOTIFY_UPDATE_COMPLETE, NULL);
 	if (!ret) {
-		/* we failed, show the icon */
-		egg_warning ("cannot update system: %s", error->message);
+		egg_debug ("ignoring due to GConf");
+		goto out;
+	}
+
+	/* TRANSLATORS: title: system update completed all okay */
+	notification = notify_notification_new_with_status_icon (_("The system update has completed"),
+								 message_text->str, "help-browser",
+								 cupdate->priv->status_icon);
+	notify_notification_set_timeout (notification, 15000);
+	notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
+	if (restart == PK_RESTART_ENUM_SYSTEM) {
+		notify_notification_add_action (notification, "restart",
+						/* TRANSLATORS: restart computer as system packages need update */
+						_("Restart computer now"), gpk_check_update_libnotify_cb, cupdate, NULL);
+//		notify_notification_add_action (notification, "do-not-show-complete-restart",
+//						/* TRANSLATORS: don't show this option again (for restart) */
+//						_("Do not show this again"), gpk_check_update_libnotify_cb, cupdate, NULL);
+	} else {
+		notify_notification_add_action (notification, "do-not-show-complete",
+						/* TRANSLATORS: don't show this option again (when finished)  */
+						_("Do not show this again"), gpk_check_update_libnotify_cb, cupdate, NULL);
+	}
+	ret = notify_notification_show (notification, &error);
+	if (!ret) {
+		egg_warning ("error: %s", error->message);
 		g_error_free (error);
-		gpk_check_update_set_icon_name (cupdate, NULL);
+	}
+out:
+	if (message_text != NULL)
+		g_string_free (message_text, TRUE);
+	if (array != NULL)
+		g_ptr_array_unref (array);
+}
+
+/**
+ * gpk_check_update_update_system_finished_cb:
+ **/
+static void
+gpk_check_update_update_system_finished_cb (GObject *object, GAsyncResult *res, GpkCheckUpdate *cupdate)
+{
+	PkClient *client = PK_CLIENT(object);
+	PkResults *results;
+	GError *error = NULL;
+
+	/* get the results */
+	results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
+	if (results == NULL) {
+		egg_warning ("failed to update system: %s", error->message);
+		g_error_free (error);
+
 		/* we failed, so re-get the update list */
+		gpk_check_update_set_icon_name (cupdate, NULL);
 		g_timeout_add_seconds (2, (GSourceFunc) gpk_check_update_get_updates_post_update_cb, cupdate);
+		goto out;
 	}
+
+	/* play the sound, using sounds from the naming spec */
+	ca_context_play (ca_gtk_context_get (), 0,
+			 /* TODO: add a new sound to the spec */
+			 CA_PROP_EVENT_ID, "complete-download",
+			 /* TRANSLATORS: this is the application name for libcanberra */
+			 CA_PROP_APPLICATION_NAME, _("GNOME PackageKit Update Icon"),
+			 /* TRANSLATORS: this is the sound description */
+			 CA_PROP_EVENT_DESCRIPTION, _("Updated successfully"), NULL);
+
+	/* notify */
+	gpk_check_update_finished_notify (cupdate, results);
+	cupdate->priv->number_updates_critical_last_shown = 0;
 out:
-	return ret;
+	if (results != NULL)
+		g_object_unref (results);
 }
 
 /**
@@ -405,13 +532,10 @@ gpk_check_update_libnotify_cb (NotifyNotification *notification, gchar *action,
 //		gpk_error_dialog (_("Error details"), _("Package Manager error details"), cupdate->priv->error_details);
 	} else if (g_strcmp0 (action, "cancel") == 0) {
 		/* try to cancel */
-		ret = pk_client_cancel (cupdate->priv->client, &error);
-		if (!ret) {
-			egg_warning ("failed to cancel client: %s", error->message);
-			g_error_free (error);
-		}
+		g_cancellable_cancel (cupdate->priv->cancellable);
 	} else if (g_strcmp0 (action, "update-all-packages") == 0) {
-		gpk_check_update_update_system (cupdate);
+		pk_client_update_system_async (cupdate->priv->client, TRUE, cupdate->priv->cancellable, NULL, NULL,
+					       (GAsyncReadyCallback) gpk_check_update_update_system_finished_cb, cupdate);
 	} else if (g_strcmp0 (action, "show-update-viewer") == 0) {
 		ret = g_spawn_command_line_async (BINDIR "/gpk-update-viewer", &error);
 		if (!ret) {
@@ -421,12 +545,9 @@ gpk_check_update_libnotify_cb (NotifyNotification *notification, gchar *action,
 	} else if (g_strcmp0 (action, "update-just-security") == 0) {
 
 		/* just update the important updates */
-		package_ids = pk_package_ids_from_array (cupdate->priv->important_updates_array);
-		ret = pk_client_update_packages (cupdate->priv->client, package_ids, &error);
-		if (!ret) {
-			egg_warning ("Individual updates failed: %s", error->message);
-			g_error_free (error);
-		}
+		package_ids = pk_ptr_array_to_strv (cupdate->priv->important_updates_array);
+		pk_client_update_packages_async (cupdate->priv->client, TRUE, package_ids, cupdate->priv->cancellable, NULL, NULL,
+						 (GAsyncReadyCallback) gpk_check_update_update_system_finished_cb, cupdate);
 		g_strfreev (package_ids);
 
 	} else if (g_strcmp0 (action, "distro-upgrade-info") == 0) {
@@ -438,7 +559,6 @@ gpk_check_update_libnotify_cb (NotifyNotification *notification, gchar *action,
 	} else {
 		egg_warning ("unknown action id: %s", action);
 	}
-out:
 	return;
 }
 
@@ -477,11 +597,7 @@ gpk_check_update_critical_updates_warning (GpkCheckUpdate *cupdate, const gchar
 	cupdate->priv->number_updates_critical_last_shown = array->len;
 
 	/* save for later */
-	if (cupdate->priv->important_updates_array != NULL) {
-		g_ptr_array_foreach (cupdate->priv->important_updates_array, (GFunc) g_free, NULL);
-		g_ptr_array_free (cupdate->priv->important_updates_array, TRUE);
-	}
-	cupdate->priv->important_updates_array = g_ptr_array_new ();
+	g_ptr_array_set_size (cupdate->priv->important_updates_array, 0);
 	for (i=0; i<array->len; i++) {
 		package_id = g_ptr_array_index (array, i);
 		g_ptr_array_add (cupdate->priv->important_updates_array, g_strdup (package_id));
@@ -541,7 +657,7 @@ gpk_check_update_critical_updates_warning (GpkCheckUpdate *cupdate, const gchar
  * gpk_check_update_client_info_to_bitfield:
  **/
 static PkBitfield
-gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, GPtrArray *list)
+gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, GPtrArray *array)
 {
 	guint i;
 	PkBitfield infos = 0;
@@ -551,20 +667,20 @@ gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, GPtrArray *li
 	g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), PK_INFO_ENUM_UNKNOWN);
 
 	/* shortcut */
-	if (list->len == 0)
+	if (array->len == 0)
 		return PK_INFO_ENUM_UNKNOWN;
 
-	/* add each status to a list */
-	for (i=0; i<list->len; i++) {
-		item = g_ptr_array_index (list, i);
+	/* add each status to a array */
+	for (i=0; i<array->len; i++) {
+		item = g_ptr_array_index (array, i);
 		if (item == NULL) {
 			egg_warning ("not found item %i", i);
 			break;
 		}
 		split = pk_package_id_split (item->package_id);
-		egg_debug ("%s %s", split[PK_PACKAGE_ID_NAME], pk_info_enum_to_text (item->info_enum));
+		egg_debug ("%s %s", split[PK_PACKAGE_ID_NAME], pk_info_enum_to_text (item->info));
 		g_strfreev (split);
-		pk_bitfield_add (infos, item->info_enum);
+		pk_bitfield_add (infos, item->info);
 	}
 	return infos;
 }
@@ -573,7 +689,7 @@ gpk_check_update_client_info_to_bitfield (GpkCheckUpdate *cupdate, GPtrArray *li
  * gpk_check_update_get_best_update_icon:
  **/
 static const gchar *
-gpk_check_update_get_best_update_icon (GpkCheckUpdate *cupdate, GPtrArray *list)
+gpk_check_update_get_best_update_icon (GpkCheckUpdate *cupdate, GPtrArray *array)
 {
 	gint value;
 	PkBitfield infos;
@@ -581,8 +697,8 @@ gpk_check_update_get_best_update_icon (GpkCheckUpdate *cupdate, GPtrArray *list)
 
 	g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), NULL);
 
-	/* get an enumerated list with all the update types */
-	infos = gpk_check_update_client_info_to_bitfield (cupdate, list);
+	/* get an enumerated array with all the update types */
+	infos = gpk_check_update_client_info_to_bitfield (cupdate, array);
 
 	/* get the most important icon */
 	value = pk_bitfield_contain_priority (infos,
@@ -679,34 +795,6 @@ gpk_check_update_get_update_policy (GpkCheckUpdate *cupdate)
 }
 
 /**
- * gpk_check_update_query_updates:
- **/
-static gboolean
-gpk_check_update_query_updates (GpkCheckUpdate *cupdate, gboolean policy_action)
-{
-	gboolean ret = FALSE;
-	GError *error = NULL;
-
-	g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), FALSE);
-
-	/* No point if we are already updating */
-	if (pk_transaction_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_PACKAGES) ||
-	    pk_transaction_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
-		egg_debug ("Not checking for updates as already in progress");
-		goto out;
-	}
-
-	ret = pk_client_get_updates (cupdate->priv->client, PK_FILTER_ENUM_NONE, &error);
-	if (!ret) {
-		egg_warning ("cannot get updates: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-out:
-	return ret;
-}
-
-/**
  * gpk_check_update_notify_doing_updates:
  **/
 static void
@@ -744,78 +832,67 @@ out:
 }
 
 /**
- * gpk_check_update_policy_all_idle_cb:
+ * gpk_check_update_get_updates_finished_cb:
  **/
-static gboolean
-gpk_check_update_policy_all_idle_cb (GpkCheckUpdate *cupdate)
-{
-	gboolean ret;
-	ret = gpk_check_update_update_system (cupdate);
-	if (ret)
-		gpk_check_update_notify_doing_updates (cupdate);
-
-	/* never repeat */
-	return FALSE;
-}
-
-/**
- * gpk_check_update_process_updates:
- **/
-static gboolean
-gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboolean policy_action)
+static void
+gpk_check_update_get_updates_finished_cb (GObject *object, GAsyncResult *res, GpkCheckUpdate *cupdate)
 {
+	PkClient *client = PK_CLIENT(object);
+	PkResults *results;
+	GError *error = NULL;
 	const PkItemPackage *item;
 	guint i;
 	guint more;
 	guint showing = 0;
 	gboolean ret = FALSE;
-	GString *status_security;
-	GString *status_tooltip;
+	GString *status_security = NULL;
+	GString *status_tooltip = NULL;
 	GpkUpdateEnum update;
-	GPtrArray *security_array;
+	GPtrArray *security_array = NULL;
 	const gchar *icon;
-	gchar *package_id;
 	gchar **package_ids;
-	GError *error = NULL;
 	gchar **split;
+	GPtrArray *array = NULL;
 
-	g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), FALSE);
+	/* get the results */
+	results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
+	if (results == NULL) {
+		egg_warning ("failed to get updates: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
 
 	/* sort by name */
-	pk_package_list_sort (list);
-
-	/* filter out the same package with multiple architectures */
-	pk_package_list_set_fuzzy_arch (list, TRUE);
-	pk_item_list_remove_duplicate (list);
-
-	/* we have updates to process */
-	status_security = g_string_new ("");
-	status_tooltip = g_string_new ("");
-	security_array = g_ptr_array_new ();
+//	pk_package_list_sort (array);
 
-	/* find packages */
-	egg_debug ("length=%i", list->len);
+	/* get data */
+	array = pk_results_get_package_array (results);
 
 	/* we have no updates */
-	if (list->len == 0) {
+	if (array->len == 0) {
 		egg_debug ("no updates");
 		gpk_check_update_set_icon_name (cupdate, NULL);
 		goto out;
 	}
 
+	/* we have updates to process */
+	status_security = g_string_new ("");
+	status_tooltip = g_string_new ("");
+	security_array = g_ptr_array_new_with_free_func (g_free);
+
 	/* find the security updates first */
-	for (i=0; i<list->len; i++) {
-		item = g_ptr_array_index (list, i);
-		if (item->info_enum == PK_INFO_ENUM_SECURITY) {
+	for (i=0; i<array->len; i++) {
+		item = g_ptr_array_index (array, i);
+		if (item->info == PK_INFO_ENUM_SECURITY) {
 			/* add to array */
 			g_ptr_array_add (security_array, g_strdup (item->package_id));
 		}
 	}
 
 	/* get the security update text */
-	for (i=0; i<length; i++) {
-		item = g_ptr_array_index (list, i);
-		if (item->info_enum != PK_INFO_ENUM_SECURITY)
+	for (i=0; i<array->len; i++) {
+		item = g_ptr_array_index (array, i);
+		if (item->info != PK_INFO_ENUM_SECURITY)
 			continue;
 
 		/* don't use a huge notification that won't fit on the screen */
@@ -833,7 +910,7 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboo
 	}
 
 	/* work out icon (cannot be NULL) */
-	icon = gpk_check_update_get_best_update_icon (cupdate, list);
+	icon = gpk_check_update_get_best_update_icon (cupdate, array);
 	gpk_check_update_set_icon_name (cupdate, icon);
 
 	/* make tooltip */
@@ -841,11 +918,11 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboo
 		g_string_set_size (status_security, status_security->len-1);
 	/* TRANSLATORS: tooltip: how many updates are waiting to be applied */
 	g_string_append_printf (status_tooltip, ngettext ("There is %d update available",
-							  "There are %d updates available", length), length);
+							  "There are %d updates available", array->len), array->len);
 	gtk_status_icon_set_tooltip_text (cupdate->priv->status_icon, status_tooltip->str);
 
 	/* if we are just refreshing after a failed update, don't try to do the actions */
-	if (!policy_action) {
+	if (FALSE) { //TODO
 		egg_debug ("skipping actions");
 		ret = TRUE;
 		goto out;
@@ -909,14 +986,10 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboo
 		}
 
 		/* convert */
-		package_ids = pk_package_ids_from_array (security_array);
-		ret = pk_client_update_packages (cupdate->priv->client, package_ids, &error);
-		if (!ret) {
-			egg_warning ("Individual updates failed: %s", error->message);
-			g_error_free (error);
-		} else {
-			gpk_check_update_notify_doing_updates (cupdate);
-		}
+		package_ids = pk_ptr_array_to_strv (security_array);
+		pk_client_update_packages_async (cupdate->priv->client, TRUE, package_ids, cupdate->priv->cancellable, NULL, NULL,
+						 (GAsyncReadyCallback) gpk_check_update_update_system_finished_cb, cupdate);
+		gpk_check_update_notify_doing_updates (cupdate);
 		g_strfreev (package_ids);
 		goto out;
 	}
@@ -924,18 +997,47 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, GPtrArray *list, gboo
 	/* just do everything */
 	if (update == GPK_UPDATE_ENUM_ALL) {
 		egg_debug ("we should do the update automatically!");
-		g_idle_add ((GSourceFunc) gpk_check_update_policy_all_idle_cb, cupdate);
+		pk_client_update_system_async (cupdate->priv->client, TRUE, cupdate->priv->cancellable, NULL, NULL,
+					       (GAsyncReadyCallback) gpk_check_update_update_system_finished_cb, cupdate);
+		gpk_check_update_notify_doing_updates (cupdate);
 		goto out;
 	}
 
 	/* shouldn't happen */
 	egg_warning ("unknown update mode");
 out:
-	g_string_free (status_security, TRUE);
-	g_string_free (status_tooltip, TRUE);
-	g_ptr_array_foreach (security_array, (GFunc) g_free, NULL);
-	g_ptr_array_free (security_array, TRUE);
-	return ret;
+	if (status_security != NULL)
+		g_string_free (status_security, TRUE);
+	if (status_tooltip != NULL)
+		g_string_free (status_tooltip, TRUE);
+	if (security_array != NULL)
+		g_ptr_array_unref (security_array);
+	if (array != NULL)
+		g_ptr_array_unref (array);
+	if (results != NULL)
+		g_object_unref (results);
+}
+
+/**
+ * gpk_check_update_query_updates:
+ **/
+static void
+gpk_check_update_query_updates (GpkCheckUpdate *cupdate)
+{
+	g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
+
+	/* No point if we are already updating */
+	if (pk_transaction_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_PACKAGES) ||
+	    pk_transaction_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
+		egg_debug ("Not checking for updates as already in progress");
+		goto out;
+	}
+
+	/* get new update list */
+	pk_client_get_updates_async (cupdate->priv->client, PK_FILTER_ENUM_NONE, cupdate->priv->cancellable, NULL, NULL,
+				     (GAsyncReadyCallback) gpk_check_update_get_updates_finished_cb, cupdate);
+out:
+	return;
 }
 
 /**
@@ -945,7 +1047,7 @@ static gboolean
 gpk_check_update_query_updates_idle_cb (GpkCheckUpdate *cupdate)
 {
 	egg_debug ("idle cb");
-	gpk_check_update_query_updates (cupdate, TRUE);
+	gpk_check_update_query_updates (cupdate);
 	return FALSE;
 }
 
@@ -957,7 +1059,7 @@ gpk_check_update_query_updates_changed_cb (GpkCheckUpdate *cupdate)
 {
 	egg_debug ("getting new update list (after we waited a short delay)");
 	cupdate->priv->updates_changed_id = 0;
-	gpk_check_update_query_updates (cupdate, TRUE);
+	gpk_check_update_query_updates (cupdate);
 	return FALSE;
 }
 
@@ -1028,73 +1130,81 @@ gpk_check_update_task_list_changed_cb (PkTransactionList *tlist, GpkCheckUpdate
 	gpk_check_update_set_icon_visibility (cupdate);
 }
 
+
 /**
- * gpk_check_update_auto_refresh_cache_cb:
+ * gpk_check_update_refresh_cache_finished_cb:
  **/
 static void
-gpk_check_update_auto_refresh_cache_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate *cupdate)
+gpk_check_update_refresh_cache_finished_cb (GObject *object, GAsyncResult *res, GpkCheckUpdate *cupdate)
 {
-	gboolean ret;
+	PkClient *client = PK_CLIENT(object);
+	PkResults *results;
 	GError *error = NULL;
 
-	g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
-
-	ret = pk_client_refresh_cache (cupdate->priv->client, TRUE, &error);
-	if (!ret) {
-		egg_warning ("cannot refresh cache: %s", error->message);
+	/* get the results */
+	results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
+	if (results == NULL) {
+		egg_warning ("failed to refresh the cache: %s", error->message);
 		g_error_free (error);
 		goto out;
 	}
 out:
-	return;
+	if (results != NULL)
+		g_object_unref (results);
 }
 
 /**
- * gpk_check_update_auto_get_updates_cb:
+ * gpk_check_update_auto_refresh_cache_cb:
  **/
 static void
-gpk_check_update_auto_get_updates_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate *cupdate)
+gpk_check_update_auto_refresh_cache_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate *cupdate)
 {
 	g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
 
-	/* show the icon at login time */
-	egg_debug ("login cb");
-	g_idle_add ((GSourceFunc) gpk_check_update_query_updates_idle_cb, cupdate);
+	pk_client_refresh_cache_async (cupdate->priv->client, TRUE, cupdate->priv->cancellable, NULL, NULL,
+				       (GAsyncReadyCallback) gpk_check_update_refresh_cache_finished_cb, cupdate);
 }
 
 /**
- * gpk_check_update_auto_get_upgrades_cb:
+ * gpk_check_update_auto_get_updates_cb:
  **/
 static void
-gpk_check_update_auto_get_upgrades_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate *cupdate)
+gpk_check_update_auto_get_updates_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate *cupdate)
 {
-	gboolean ret;
-	GError *error = NULL;
+	g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
 
-	ret = pk_client_get_distro_upgrades (cupdate->priv->client, &error);
-	if (!ret) {
-		egg_warning ("cannot get updates: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-out:
-	return;
+	/* show the icon at login time */
+	egg_debug ("login cb");
+	g_idle_add ((GSourceFunc) gpk_check_update_query_updates_idle_cb, cupdate);
 }
 
 /**
- * gpk_check_update_process_distro_upgrades:
+ * gpk_check_update_get_distro_upgrades_finished_cb:
  **/
 static void
-gpk_check_update_process_distro_upgrades (GpkCheckUpdate *cupdate, GPtrArray *array)
+gpk_check_update_get_distro_upgrades_finished_cb (GObject *object, GAsyncResult *res, GpkCheckUpdate *cupdate)
 {
-	gboolean ret;
+	PkClient *client = PK_CLIENT(object);
+	PkResults *results;
 	GError *error = NULL;
+	GPtrArray *array;
+	gboolean ret;
 	guint i;
-	PkDistroUpgradeObj *item;
+	PkItemDistroUpgrade *item;
 	const gchar *title;
 	NotifyNotification *notification;
 	GString *string = NULL;
-	g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
+
+	/* get the results */
+	results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
+	if (results == NULL) {
+		egg_warning ("failed to get upgrades: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+
+	/* process results */
+	array = pk_results_get_distro_upgrade_array (results);
 
 	/* any updates? */
 	if (array->len == 0) {
@@ -1112,7 +1222,7 @@ gpk_check_update_process_distro_upgrades (GpkCheckUpdate *cupdate, GPtrArray *ar
 	/* find the upgrade string */
 	string = g_string_new ("");
 	for (i=0; i < array->len; i++) {
-		item = (PkDistroUpgradeObj *) g_ptr_array_index (array, i);
+		item = (PkItemDistroUpgrade *) g_ptr_array_index (array, i);
 		g_string_append_printf (string, "%s (%s)\n", item->name, pk_distro_upgrade_enum_to_text (item->state));
 	}
 	if (string->len != 0)
@@ -1122,7 +1232,7 @@ gpk_check_update_process_distro_upgrades (GpkCheckUpdate *cupdate, GPtrArray *ar
 	title = _("Distribution upgrades available");
 	notification = notify_notification_new_with_status_icon (title, string->str, "help-browser", cupdate->priv->status_icon);
 	if (notification == NULL) {
-		egg_warning ("failed to get bubble");
+		egg_warning ("failed to make bubble");
 		return;
 	}
 	notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);
@@ -1139,8 +1249,22 @@ gpk_check_update_process_distro_upgrades (GpkCheckUpdate *cupdate, GPtrArray *ar
 		g_error_free (error);
 	}
 out:
+	if (array != NULL)
+		g_ptr_array_unref (array);
 	if (string != NULL)
 		g_string_free (string, TRUE);
+	if (results != NULL)
+		g_object_unref (results);
+}
+
+/**
+ * gpk_check_update_auto_get_upgrades_cb:
+ **/
+static void
+gpk_check_update_auto_get_upgrades_cb (GpkAutoRefresh *arefresh, GpkCheckUpdate *cupdate)
+{
+	pk_client_get_distro_upgrades_async (cupdate->priv->client, cupdate->priv->cancellable, NULL, NULL,
+					     (GAsyncReadyCallback) gpk_check_update_get_distro_upgrades_finished_cb, cupdate);
 }
 
 /**
@@ -1149,10 +1273,12 @@ out:
 static void
 gpk_check_update_notify_network_status_cb (PkControl *control, GParamSpec *pspec, GpkCheckUpdate *cupdate)
 {
-	g_object_get (control, "network-status", &state, NULL);
+	PkNetworkEnum *status;
+
+	g_object_get (control, "network-status", &status, NULL);
 
 	/* inhibit icon when we are offline */
-	cupdate->priv->icon_inhibit_network_offline = (state == PK_NETWORK_ENUM_OFFLINE);
+	cupdate->priv->icon_inhibit_network_offline = (status == PK_NETWORK_ENUM_OFFLINE);
 	gpk_check_update_set_icon_visibility (cupdate);
 }
 
@@ -1169,16 +1295,13 @@ gpk_cupdate_connection_changed_cb (EggDbusMonitor *monitor, gboolean connected,
 	gpk_check_update_set_icon_visibility (cupdate);
 }
 
+#if 0
 /**
  * gpk_check_update_error_code_cb:
  **/
 static void
 gpk_check_update_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar *details, GpkCheckUpdate *cupdate)
 {
-	PkRoleEnum role;
-	gboolean ret;
-	GError *error = NULL;
-
 	/* ignore some errors */
 	if (code == PK_ERROR_ENUM_PROCESS_KILL ||
 	    code == PK_ERROR_ENUM_TRANSACTION_CANCELLED) {
@@ -1186,14 +1309,6 @@ gpk_check_update_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gc
 		goto out;
 	}
 
-	/* get the role */
-	ret = pk_client_get_role (client, &role, NULL, &error);
-	if (!ret) {
-		egg_warning ("failed to get role: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-
 	/* if we're doing queries automatically for the user, don't spam them
 	   with locking failure messages */
 	if (code == PK_ERROR_ENUM_CANNOT_GET_LOCK) {
@@ -1210,6 +1325,7 @@ gpk_check_update_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gc
 out:
 	return;
 }
+#endif
 
 /**
  * gpk_check_update_repo_signature_event_cb:
@@ -1225,7 +1341,7 @@ gpk_check_update_repo_signature_event_cb (GpkHelperRepoSignature *helper_repo_si
 	}
 
 	/* install signature */
-	ret = pk_client_install_signature (cupdate->priv->client, PK_SIGTYPE_ENUM_GPG, key_id, package_id, &error);
+	ret = FALSE;//pk_client_install_signature_async (cupdate->priv->client, cupdate->priv->cancellable, PK_SIGTYPE_ENUM_GPG, key_id, package_id, &error);
 	if (!ret) {
 		egg_warning ("cannot install signature: %s", error->message);
 		g_error_free (error);
@@ -1233,7 +1349,7 @@ gpk_check_update_repo_signature_event_cb (GpkHelperRepoSignature *helper_repo_si
 	}
 	/* set state */
 	egg_debug ("repo sig cb");
-	gpk_check_update_query_updates (cupdate, TRUE);
+	gpk_check_update_query_updates (cupdate);
 out:
 	return;
 }
@@ -1253,161 +1369,36 @@ gpk_check_update_repo_signature_required_cb (PkClient *client, const gchar *pack
 }
 
 /**
- * gpk_check_update_finished_notify:
+ * gpk_check_update_get_properties_cb:
  **/
 static void
-gpk_check_update_finished_notify (GpkCheckUpdate *cupdate, PkClient *client)
+gpk_check_update_get_properties_cb (GObject *object, GAsyncResult *res, GpkCheckUpdate *cupdate)
 {
-	gboolean ret;
+	PkNetworkEnum state;
 	GError *error = NULL;
-	NotifyNotification *notification;
-	PkRestartEnum restart;
-	guint i;
-	GPtrArray *list;
-	const PkItemPackage *item;
-	GString *message_text;
-	guint skipped_number = 0;
-	const gchar *message;
-	gchar **split;
-
-	/* check we got some packages */
-	list = pk_results_get_package_array (client);
-	egg_debug ("length=%i", list->len);
-	if (list->len == 0) {
-		egg_debug ("no updates");
-		return;
-	}
-
-	message_text = g_string_new ("");
-
-	/* find any we skipped */
-	for (i=0; i<list->len; i++) {
-		item = g_ptr_array_index (list, i);
-
-		split = pk_package_id_split (item->package_id);
-		egg_debug ("%s, %s, %s", pk_info_enum_to_text (item->info_enum),
-			   split[PK_PACKAGE_ID_NAME], item->summary);
-		if (item->info_enum == PK_INFO_ENUM_BLOCKED) {
-			skipped_number++;
-			g_string_append_printf (message_text, "<b>%s</b> - %s\n",
-						split[PK_PACKAGE_ID_NAME], item->summary);
-		}
-		g_strfreev (split);
-	}
-	g_object_unref (list);
-
-	/* notify the user if there were skipped entries */
-	if (skipped_number > 0) {
-		/* TRANSLATORS: we did the update, but some updates were skipped and not applied */
-		message = ngettext ("One package was skipped:",
-				    "Some packages were skipped:", skipped_number);
-		g_string_prepend (message_text, message);
-		g_string_append_c (message_text, '\n');
-	}
-
-	/* add a message that we need to restart */
-	restart = pk_client_get_require_restart (client);
-	if (restart != PK_RESTART_ENUM_NONE) {
-		message = gpk_restart_enum_to_localised_text (restart);
-
-		/* add a gap if we are putting both */
-		if (skipped_number > 0)
-			g_string_append (message_text, "\n");
-
-		g_string_append (message_text, message);
-		g_string_append_c (message_text, '\n');
-	}
-
-	/* trim off extra newlines */
-	if (message_text->len != 0)
-		g_string_set_size (message_text, message_text->len-1);
-
-	/* do we do the notification? */
-	ret = gconf_client_get_bool (cupdate->priv->gconf_client, GPK_CONF_NOTIFY_UPDATE_COMPLETE, NULL);
-	if (!ret) {
-		egg_debug ("ignoring due to GConf");
-		return;
-	}
+	PkControl *control = PK_CONTROL(object);
+	gboolean ret;
+	PkBitfield roles;
 
-	/* TRANSLATORS: title: system update completed all okay */
-	notification = notify_notification_new_with_status_icon (_("The system update has completed"),
-								 message_text->str, "help-browser",
-								 cupdate->priv->status_icon);
-	notify_notification_set_timeout (notification, 15000);
-	notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
-	if (restart == PK_RESTART_ENUM_SYSTEM) {
-		notify_notification_add_action (notification, "restart",
-						/* TRANSLATORS: restart computer as system packages need update */
-						_("Restart computer now"), gpk_check_update_libnotify_cb, cupdate, NULL);
-//		notify_notification_add_action (notification, "do-not-show-complete-restart",
-//						/* TRANSLATORS: don't show this option again (for restart) */
-//						_("Do not show this again"), gpk_check_update_libnotify_cb, cupdate, NULL);
-	} else {
-		notify_notification_add_action (notification, "do-not-show-complete",
-						/* TRANSLATORS: don't show this option again (when finished)  */
-						_("Do not show this again"), gpk_check_update_libnotify_cb, cupdate, NULL);
-	}
-	ret = notify_notification_show (notification, &error);
+	/* get the result */
+	ret = pk_control_get_properties_finish (control, res, &error);
 	if (!ret) {
-		egg_warning ("error: %s", error->message);
+		/* TRANSLATORS: backend is broken, and won't tell us what it supports */
+		egg_warning ("details could not be retrieved: %s", error->message);
 		g_error_free (error);
-	}
-	g_string_free (message_text, TRUE);
-}
-
-/**
- * gpk_check_update_finished_cb:
- **/
-static void
-gpk_check_update_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime, GpkCheckUpdate *cupdate)
-{
-	PkRoleEnum role;
-	GPtrArray *list;
-	GPtrArray *array;
-
-	pk_client_get_role (client, &role, NULL, NULL);
-	egg_debug ("role: %s, exit: %s", pk_role_enum_to_text (role), pk_exit_enum_to_text (exit_enum));
-
-	/* get-updates */
-	if (role == PK_ROLE_ENUM_GET_UPDATES &&
-	    exit_enum == PK_EXIT_ENUM_SUCCESS) {
-		list = pk_results_get_package_array (client);
-		gpk_check_update_process_updates (cupdate, list, TRUE);
-		g_object_unref (list);
-	}
-
-	/* get-upgrades */
-	if (role == PK_ROLE_ENUM_GET_DISTRO_UPGRADES &&
-	    exit_enum == PK_EXIT_ENUM_SUCCESS) {
-		array = pk_client_get_distro_upgrade_list (client);
-		gpk_check_update_process_distro_upgrades (cupdate, array);
-		g_object_unref (array);
-	}
-
-	/* refresh-cache */
-	if (role == PK_ROLE_ENUM_REFRESH_CACHE &&
-	    exit_enum == PK_EXIT_ENUM_SUCCESS) {
-		egg_debug ("finished refresh cb");
-		gpk_check_update_query_updates (cupdate, TRUE);
+		goto out;
 	}
 
-	/* updates */
-	if ((role == PK_ROLE_ENUM_UPDATE_PACKAGES ||
-	     role == PK_ROLE_ENUM_UPDATE_SYSTEM) &&
-	    exit_enum == PK_EXIT_ENUM_SUCCESS) {
-
-		/* play the sound, using sounds from the naming spec */
-		ca_context_play (ca_gtk_context_get (), 0,
-				 /* TODO: add a new sound to the spec */
-				 CA_PROP_EVENT_ID, "complete-download",
-				 /* TRANSLATORS: this is the application name for libcanberra */
-				 CA_PROP_APPLICATION_NAME, _("GNOME PackageKit Update Icon"),
-				 /* TRANSLATORS: this is the sound description */
-				 CA_PROP_EVENT_DESCRIPTION, _("Updated successfully"), NULL);
+	/* get values */
+	g_object_get (control,
+		      "roles", &roles,
+		      "network-state", &state,
+		      NULL);
 
-		gpk_check_update_finished_notify (cupdate, client);
-		cupdate->priv->number_updates_critical_last_shown = 0;
-	}
+	/* coldplug network state */
+	cupdate->priv->icon_inhibit_network_offline = (state == PK_NETWORK_ENUM_OFFLINE);
+out:
+	return;
 }
 
 /**
@@ -1418,16 +1409,16 @@ static void
 gpk_check_update_init (GpkCheckUpdate *cupdate)
 {
 	gboolean ret;
-	PkNetworkEnum state;
 
 	cupdate->priv = GPK_CHECK_UPDATE_GET_PRIVATE (cupdate);
 
 	cupdate->priv->updates_changed_id = 0;
 	cupdate->priv->notification_updates_available = NULL;
-	cupdate->priv->important_updates_array = NULL;
+	cupdate->priv->important_updates_array = g_ptr_array_new_with_free_func (g_free);
 	cupdate->priv->icon_name = NULL;
 	cupdate->priv->number_updates_critical_last_shown = 0;
 	cupdate->priv->status_icon = gtk_status_icon_new ();
+	cupdate->priv->cancellable = g_cancellable_new ();
 
 	/* preload all the common GConf keys */
 	cupdate->priv->gconf_client = gconf_client_get_default ();
@@ -1461,12 +1452,6 @@ gpk_check_update_init (GpkCheckUpdate *cupdate)
 
 	/* use an asynchronous query object */
 	cupdate->priv->client = pk_client_new ();
-	g_signal_connect (cupdate->priv->client, "finished",
-			  G_CALLBACK (gpk_check_update_finished_cb), cupdate);
-	g_signal_connect (cupdate->priv->client, "error-code",
-			  G_CALLBACK (gpk_check_update_error_code_cb), cupdate);
-	g_signal_connect (cupdate->priv->client, "repo-signature-required",
-			  G_CALLBACK (gpk_check_update_repo_signature_required_cb), cupdate);
 
 	/* helpers */
 	cupdate->priv->helper_repo_signature = gpk_helper_repo_signature_new ();
@@ -1490,9 +1475,8 @@ gpk_check_update_init (GpkCheckUpdate *cupdate)
 		(pk_transaction_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_SYSTEM) ||
 		 pk_transaction_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_PACKAGES));
 
-	/* coldplug network state */
-	state = pk_control_get_network_state (cupdate->priv->control, NULL);
-	cupdate->priv->icon_inhibit_network_offline = (state == PK_NETWORK_ENUM_OFFLINE);
+	/* get properties */
+	pk_control_get_properties_async (cupdate->priv->control, cupdate->priv->cancellable, (GAsyncReadyCallback) gpk_check_update_get_properties_cb, cupdate);
 
 	/* coldplug update viewer connected */
 	ret = egg_dbus_monitor_is_connected (cupdate->priv->dbus_monitor_viewer);
@@ -1522,10 +1506,8 @@ gpk_check_update_finalize (GObject *object)
 	g_object_unref (cupdate->priv->client);
 	g_object_unref (cupdate->priv->dbus_monitor_viewer);
 	g_object_unref (cupdate->priv->helper_repo_signature);
-	if (cupdate->priv->important_updates_array != NULL) {
-		g_ptr_array_foreach (cupdate->priv->important_updates_array, (GFunc) g_free, NULL);
-		g_ptr_array_free (cupdate->priv->important_updates_array, TRUE);
-	}
+	g_object_unref (cupdate->priv->cancellable);
+	g_ptr_array_unref (cupdate->priv->important_updates_array);
 	g_free (cupdate->priv->icon_name);
 	if (cupdate->priv->updates_changed_id > 0)
 		g_source_remove (cupdate->priv->updates_changed_id);
diff --git a/src/gpk-dbus-task.c b/src/gpk-dbus-task.c
index 842b8be..2603bda 100644
--- a/src/gpk-dbus-task.c
+++ b/src/gpk-dbus-task.c
@@ -728,10 +728,10 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
 		/* see what we've got already */
 		for (i=0; i<len; i++) {
 			item = g_ptr_array_index (list, i);
-			if (item->info_enum == PK_INFO_ENUM_INSTALLED) {
+			if (item->info == PK_INFO_ENUM_INSTALLED) {
 				already_installed = TRUE;
 				id = item->package_id;
-			} else if (item->info_enum == PK_INFO_ENUM_AVAILABLE) {
+			} else if (item->info == PK_INFO_ENUM_AVAILABLE) {
 				egg_debug ("package '%s' resolved to:", item->package_id);
 				id = item->package_id;
 			}
@@ -780,8 +780,8 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
 
 #if PK_CHECK_VERSION(0,5,2)
 			/* not interesting */
-			if (item->info_enum != PK_INFO_ENUM_UPDATING &&
-			    item->info_enum != PK_INFO_ENUM_INSTALLING)
+			if (item->info != PK_INFO_ENUM_UPDATING &&
+			    item->info != PK_INFO_ENUM_INSTALLING)
 				continue;
 #endif
 
@@ -789,7 +789,7 @@ gpk_dbus_task_finished_cb (PkClient *client, PkExitEnum exit_enum, guint runtime
 			if (g_strcmp0 (item->package_id->data, "local") == 0)
 				continue;
 
-			g_ptr_array_add_xxxwithrecount (new, item->info_enum, item->package_id, item->summary);
+			g_ptr_array_add_xxxwithrecount (new, item->info, item->package_id, item->summary);
 		}
 
 		/* these are the new packages */
@@ -860,7 +860,7 @@ skip_checks:
 			/* filter out installed */
 			for (i=0; i<list->len; i++) {
 				item = g_ptr_array_index (list, i);
-				if (item->info_enum != PK_INFO_ENUM_INSTALLING) {
+				if (item->info != PK_INFO_ENUM_INSTALLING) {
 					pk_item_list_remove_index (list, i);
 					i--;
 				}
@@ -940,9 +940,9 @@ skip_checks:
 		/* see what we've got already */
 		for (i=0; i<len; i++) {
 			item = g_ptr_array_index (list, i);
-			if (item->info_enum == PK_INFO_ENUM_INSTALLED) {
+			if (item->info == PK_INFO_ENUM_INSTALLED) {
 				already_installed = TRUE;
-			} else if (item->info_enum == PK_INFO_ENUM_AVAILABLE) {
+			} else if (item->info == PK_INFO_ENUM_AVAILABLE) {
 				egg_debug ("package '%s' resolved", item->package_id);
 				id = item->package_id;
 				//TODO: we need to list these in a gpk-dbus_task-chooser
@@ -1176,14 +1176,14 @@ gpk_dbus_task_button_cancel_cb (GtkWidget *widget, GpkDbusTask *task)
 	GError *error = NULL;
 
 	/* we might have a transaction running */
-	ret = pk_client_cancel (task->priv->client_primary, &error);
+	ret = g_cancellable_cancel (task->priv->client_primary, &error);
 	if (!ret) {
 		egg_warning ("failed to cancel client: %s", error->message);
 		g_error_free (error);
 		goto out;
 	}
 
-	ret = pk_client_cancel (task->priv->client_secondary, &error);
+	ret = g_cancellable_cancel (task->priv->client_secondary, &error);
 	if (!ret) {
 		egg_warning ("failed to cancel client: %s", error->message);
 		g_error_free (error);
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 3b60605..76e7eeb 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -207,7 +207,7 @@ gpk_update_viewer_quit (void)
 
 	/* cancel the transaction */
 	if (allow_cancel) {
-		ret = pk_client_cancel (client_primary, &error);
+		ret = g_cancellable_cancel (client_primary, &error);
 		if (!ret) {
 			egg_warning ("failed to cancel client: %s", error->message);
 			g_error_free (error);
@@ -419,7 +419,7 @@ gpk_update_viewer_button_install_cb (GtkWidget *widget, gpointer data)
 	gtk_tree_selection_unselect_all (selection);
 
 	/* save for finished */
-	package_ids = pk_package_ids_from_array (array);
+	package_ids = pk_ptr_array_to_strv (array);
 	g_strfreev (install_package_ids);
 	install_package_ids = g_strdupv (package_ids);
 
@@ -580,7 +580,7 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *item, gpoin
 
 	pk_client_get_role (client, &role, NULL, NULL);
 	egg_debug ("role = %s, package = %s:%s:%s", pk_role_enum_to_text (role),
-		   pk_info_enum_to_text (item->info_enum), "xxx", item->summary);
+		   pk_info_enum_to_text (item->info), "xxx", item->summary);
 
 	/* are we simulating to get deps? */
 #if PK_CHECK_VERSION(0,5,2)
@@ -596,7 +596,7 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *item, gpoin
 #endif
 
 	/* used for progress */
-	if (!gpk_update_viewer_is_update_info (item->info_enum)) {
+	if (!gpk_update_viewer_is_update_info (item->info)) {
 		g_free (package_id_last);
 		package_id_last = pk_package_id_copy (item->package_id);
 
@@ -621,14 +621,14 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *item, gpoin
 		}
 
 		/* if the info is finished, change the status to past tense */
-		if (item->info_enum == PK_INFO_ENUM_FINISHED) {
+		if (item->info == PK_INFO_ENUM_FINISHED) {
 			gtk_tree_model_get (model, &iter,
 					    GPK_UPDATES_COLUMN_STATUS, &info, -1);
 			/* promote to past tense if present tense */
 			if (info < PK_INFO_ENUM_UNKNOWN)
 				info += PK_INFO_ENUM_UNKNOWN;
 		} else {
-			info = item->info_enum;
+			info = item->info;
 		}
 		gtk_list_store_set (list_store_updates, &iter,
 				    GPK_UPDATES_COLUMN_STATUS, info, -1);
@@ -644,12 +644,12 @@ gpk_update_viewer_package_cb (PkClient *client, const PkItemPackage *item, gpoin
 
 	/* add to list store */
 	text = gpk_package_id_format_twoline (item->package_id, item->summary);
-	selected = (item->info_enum != PK_INFO_ENUM_BLOCKED);
+	selected = (item->info != PK_INFO_ENUM_BLOCKED);
 	gtk_list_store_append (list_store_updates, &iter);
 	gtk_list_store_set (list_store_updates, &iter,
 			    GPK_UPDATES_COLUMN_TEXT, text,
 			    GPK_UPDATES_COLUMN_ID, package_id,
-			    GPK_UPDATES_COLUMN_INFO, item->info_enum,
+			    GPK_UPDATES_COLUMN_INFO, item->info,
 			    GPK_UPDATES_COLUMN_SELECT, selected,
 			    GPK_UPDATES_COLUMN_SENSITIVE, selected,
 			    GPK_UPDATES_COLUMN_CLICKABLE, selected,
@@ -1410,7 +1410,7 @@ gpk_update_viewer_check_blocked_packages (GPtrArray *list)
 	/* find any that are blocked */
 	for (i=0;i<list->len;i++) {
 		item = g_ptr_array_index (list, i);
-		if (item->info_enum == PK_INFO_ENUM_BLOCKED) {
+		if (item->info == PK_INFO_ENUM_BLOCKED) {
 			text = gpk_package_id_format_oneline (item->package_id, item->summary);
 			g_string_append_printf (string, "%s\n", text);
 			g_free (text);
@@ -1653,7 +1653,7 @@ gpk_update_viewer_deps_update_event_cb (GpkHelperDepsUpdate *helper, GtkResponse
 			gtk_list_store_set (list_store_updates, &iter,
 					    GPK_UPDATES_COLUMN_TEXT, text,
 					    GPK_UPDATES_COLUMN_ID, item->package_id,
-					    GPK_UPDATES_COLUMN_INFO, item->info_enum,
+					    GPK_UPDATES_COLUMN_INFO, item->info,
 					    GPK_UPDATES_COLUMN_SELECT, TRUE,
 					    GPK_UPDATES_COLUMN_SENSITIVE, FALSE,
 					    GPK_UPDATES_COLUMN_CLICKABLE, FALSE,
@@ -2457,7 +2457,7 @@ gpk_update_viewer_repo_signature_required_cb (PkClient *client, const gchar *pac
  * pk_client_distro_upgrade_cb:
  **/
 static void
-pk_client_distro_upgrade_cb (PkClient *client, const PkDistroUpgradeObj *item, gpointer data)
+pk_client_distro_upgrade_cb (PkClient *client, const PkItemDistroUpgrade *item, gpointer data)
 {
 	gchar *text;
 	gchar *text_format;
@@ -2987,14 +2987,14 @@ main (int argc, char *argv[])
 	g_main_loop_run (loop);
 
 	/* we might have visual stuff running, close it down */
-	ret = pk_client_cancel (client_primary, &error);
+	ret = g_cancellable_cancel (client_primary, &error);
 	if (!ret) {
 		egg_warning ("failed to cancel client: %s", error->message);
 		g_clear_error (&error);
 	}
 
 	/* we might have visual stuff running, close it down */
-	ret = pk_client_cancel (client_secondary, &error);
+	ret = g_cancellable_cancel (client_secondary, &error);
 	if (!ret) {
 		egg_warning ("failed to cancel client: %s", error->message);
 		g_error_free (error);
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index 5412473..697ca82 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -1621,7 +1621,7 @@ gpk_watch_button_cancel_cb (GtkWidget *widget, GpkWatch *watch)
 	GError *error = NULL;
 
 	/* we might have a transaction running */
-	ret = pk_client_cancel (watch->priv->client_primary, &error);
+	ret = g_cancellable_cancel (watch->priv->client_primary, &error);
 	if (!ret) {
 		egg_warning ("failed to cancel client: %s", error->message);
 		g_error_free (error);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]