[gnome-software] packagekit: Correctly detect a cancelled transaction



commit 5a888f2e771ed304f1327d04daf976cf293dfc14
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jul 8 17:46:34 2016 +0100

    packagekit: Correctly detect a cancelled transaction
    
    In this case the results object is nonvalid and the PK error is set.

 src/plugins/gs-plugin-packagekit-refresh.c |    4 +---
 src/plugins/gs-plugin-packagekit.c         |    9 +++------
 2 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index 114e21d..0192c54 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -125,10 +125,8 @@ gs_plugin_refresh (GsPlugin *plugin,
                                                 cancellable,
                                                 gs_plugin_packagekit_progress_cb, &data,
                                                 error);
-               if (results == NULL) {
-                       gs_plugin_packagekit_convert_gerror (error);
+               if (!gs_plugin_packagekit_results_valid (results, error))
                        return FALSE;
-               }
        }
 
        /* download all the packages themselves */
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 4becabc..2ca2e2f 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -294,8 +294,7 @@ gs_plugin_app_install (GsPlugin *plugin,
                                                         cancellable,
                                                         gs_plugin_packagekit_progress_cb, &data,
                                                         error);
-               if (results == NULL) {
-                       gs_plugin_packagekit_convert_gerror (error);
+               if (!gs_plugin_packagekit_results_valid (results, error)) {
                        gs_app_set_state_recover (app);
                        return FALSE;
                }
@@ -364,8 +363,7 @@ gs_plugin_app_install (GsPlugin *plugin,
                                                         cancellable,
                                                         gs_plugin_packagekit_progress_cb, &data,
                                                         error);
-               if (results == NULL) {
-                       gs_plugin_packagekit_convert_gerror (error);
+               if (!gs_plugin_packagekit_results_valid (results, error)) {
                        gs_app_set_state_recover (app);
                        return FALSE;
                }
@@ -390,8 +388,7 @@ gs_plugin_app_install (GsPlugin *plugin,
                                                      cancellable,
                                                      gs_plugin_packagekit_progress_cb, &data,
                                                      error);
-               if (results == NULL) {
-                       gs_plugin_packagekit_convert_gerror (error);
+               if (!gs_plugin_packagekit_results_valid (results, error)) {
                        gs_app_set_state_recover (app);
                        return FALSE;
                }


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