[gnome-software/603-gnome-software-reports-unknown-error-when-there-is-a-signing-issue: 160/164] packagekit: Recognize when the user declined an operation
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/603-gnome-software-reports-unknown-error-when-there-is-a-signing-issue: 160/164] packagekit: Recognize when the user declined an operation
- Date: Mon, 29 Nov 2021 11:02:50 +0000 (UTC)
commit 3e0db325ace526d9c3fefe4d8143046307aa58ce
Author: Milan Crha <mcrha redhat com>
Date: Fri Jul 9 12:37:35 2021 +0200
packagekit: Recognize when the user declined an operation
An old PackageKit returns a generic PK_CLIENT_ERROR_FAILED error with
a non-localized text "user declined interaction" in such case, thus
catch it and convert the error into GS_PLUGIN_ERROR_CANCELLED,
thus the user doesn't see a notification about declined interaction
when he/she did it.
A new PackageKit defines a specific error code for the declined interaction,
thus use that, if available.
plugins/packagekit/packagekit-common.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/plugins/packagekit/packagekit-common.c b/plugins/packagekit/packagekit-common.c
index dc79c2f62..84dbfc695 100644
--- a/plugins/packagekit/packagekit-common.c
+++ b/plugins/packagekit/packagekit-common.c
@@ -105,6 +105,21 @@ gs_plugin_packagekit_error_convert (GError **error)
case PK_CLIENT_ERROR_NOT_SUPPORTED:
error_tmp->code = GS_PLUGIN_ERROR_NOT_SUPPORTED;
break;
+ #if PK_CHECK_VERSION(1, 2, 4)
+ case PK_CLIENT_ERROR_DECLINED_INTERACTION:
+ error_tmp->code = GS_PLUGIN_ERROR_CANCELLED;
+ break;
+ #else
+ case PK_CLIENT_ERROR_FAILED:
+ /* The text is not localized on the PackageKit side and it uses a generic error code
+ * FIXME: This can be dropped when we depend on a
+ * PackageKit version which includes
https://github.com/PackageKit/PackageKit/pull/497 */
+ if (g_strcmp0 (error_tmp->message, "user declined interaction") == 0)
+ error_tmp->code = GS_PLUGIN_ERROR_CANCELLED;
+ else
+ error_tmp->code = GS_PLUGIN_ERROR_FAILED;
+ break;
+ #endif
/* this is working around a bug in libpackagekit-glib */
case PK_ERROR_ENUM_TRANSACTION_CANCELLED:
error_tmp->code = GS_PLUGIN_ERROR_CANCELLED;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]