[gnome-packagekit] Read the PkClient error code enum and try to map it to a PkErrorEnum code
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-packagekit] Read the PkClient error code enum and try to map it to a PkErrorEnum code
- Date: Mon, 15 Feb 2010 15:40:38 +0000 (UTC)
commit cd2e8352661f519ba83b3e21463dc3ea348e96be
Author: Richard Hughes <richard hughsie com>
Date: Mon Feb 15 15:04:28 2010 +0000
Read the PkClient error code enum and try to map it to a PkErrorEnum code
src/gpk-enum.h | 1 +
src/gpk-update-viewer.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/gpk-enum.h b/src/gpk-enum.h
index bc98361..4224477 100644
--- a/src/gpk-enum.h
+++ b/src/gpk-enum.h
@@ -67,6 +67,7 @@ typedef enum {
#if (!PK_CHECK_VERSION(0,6,2))
#define PK_CLIENT_ERROR_DECLINED_SIMULATION PK_CLIENT_ERROR_FAILED
#define PK_ERROR_ENUM_PACKAGE_DATABASE_CHANGED PK_ERROR_ENUM_ENUM_LAST
+#define PK_CLIENT_ERROR_LAST (PK_CLIENT_ERROR_DECLINED_SIMULATION + 1)
#endif
void gpk_enum_test (gpointer data);
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 4f55b36..88679b6 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -439,8 +439,20 @@ gpk_update_viewer_update_packages_cb (PkTask *task, GAsyncResult *res, GpkUpdate
/* get the results */
results = pk_task_generic_finish (task, res, &error);
if (results == NULL) {
- if (error->domain != PK_CLIENT_ERROR ||
- error->code != PK_CLIENT_ERROR_DECLINED_SIMULATION) {
+ /* not a PK error */
+ if (error->domain != PK_CLIENT_ERROR) {
+ /* TRANSLATORS: the PackageKit request did not complete, and it did not send an error */
+ gpk_update_viewer_error_dialog (update_viewer, _("Could not update packages"), NULL, error->message);
+ } else if (error->code == PK_CLIENT_ERROR_DECLINED_SIMULATION) {
+ egg_debug ("ignoring the declined-simulation error");
+ } else if (error->code > PK_CLIENT_ERROR_LAST) {
+ gint code = error->code - PK_CLIENT_ERROR_LAST;
+ /* we've passed the PackageKit error code in the GError->code */
+ gpk_update_viewer_error_dialog (update_viewer,
+ gpk_error_enum_to_localised_text (code),
+ gpk_error_enum_to_localised_message (code),
+ error->message);
+ } else {
/* TRANSLATORS: the PackageKit request did not complete, and it did not send an error */
gpk_update_viewer_error_dialog (update_viewer, _("Could not update packages"), NULL, error->message);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]