[gnome-software/603-gnome-software-reports-unknown-error-when-there-is-a-signing-issue] 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] packagekit: Recognize when the user declined an operation
- Date: Fri, 9 Jul 2021 10:40:59 +0000 (UTC)
commit 7022c634119d523718b48c3150f64f2f9b2aa038
Author: Milan Crha <mcrha redhat com>
Date: Fri Jul 9 12:37:35 2021 +0200
packagekit: Recognize when the user declined an operation
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.
plugins/packagekit/packagekit-common.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/plugins/packagekit/packagekit-common.c b/plugins/packagekit/packagekit-common.c
index c644ff993..1bdebee1c 100644
--- a/plugins/packagekit/packagekit-common.c
+++ b/plugins/packagekit/packagekit-common.c
@@ -102,6 +102,13 @@ gs_plugin_packagekit_error_convert (GError **error)
case PK_CLIENT_ERROR_NOT_SUPPORTED:
error_tmp->code = GS_PLUGIN_ERROR_NOT_SUPPORTED;
break;
+ case PK_CLIENT_ERROR_FAILED:
+ /* The text is not localized on the PackageKit side and it uses a generic error code
*/
+ 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;
/* 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]