[gnome-software/603-gnome-software-reports-unknown-error-when-there-is-a-signing-issue: 89/91] packagekit: Recognize when the user declined an operation




commit 0c6b7e23c243a7ffa749d3a86901c7f05accf7f0
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]