[gnome-settings-daemon/gnome-3-6] updates: Fix handling of cancelled errors



commit 82769c2f9b60cb4034465eb050d853a4d36c8cc7
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Mar 8 11:19:15 2013 +0100

    updates: Fix handling of cancelled errors

 plugins/updates/gsd-updates-manager.c |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c
index 9fc4cd3..a0eea86 100644
--- a/plugins/updates/gsd-updates-manager.c
+++ b/plugins/updates/gsd-updates-manager.c
@@ -287,6 +287,10 @@ get_distro_upgrades_finished_cb (GObject *object,
         /* get the results */
         results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
         if (results == NULL) {
+                if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                        g_error_free (error);
+                        return;
+                }
                 if (error->domain != PK_CLIENT_ERROR ||
                     error->code != PK_CLIENT_ERROR_NOT_SUPPORTED) {
                         g_warning ("failed to get upgrades: %s",
@@ -396,10 +400,14 @@ refresh_cache_finished_cb (GObject *object, GAsyncResult *res, GsdUpdatesManager
         /* get the results */
         results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
         if (results == NULL) {
+                if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                        g_error_free (error);
+                        return;
+                }
                 g_warning ("failed to refresh the cache: %s",
                            error->message);
                 g_error_free (error);
-                goto out;
+                return;
         }
 
         /* check error code */
@@ -408,9 +416,8 @@ refresh_cache_finished_cb (GObject *object, GAsyncResult *res, GsdUpdatesManager
                 g_warning ("failed to refresh the cache: %s, %s",
                            pk_error_enum_to_string (pk_error_get_code (error_code)),
                            pk_error_get_details (error_code));
-                goto out;
         }
-out:
+
         if (error_code != NULL)
                 g_object_unref (error_code);
         if (results != NULL)
@@ -642,6 +649,10 @@ package_download_finished_cb (GObject *object,
         /* get the results */
         results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
         if (results == NULL) {
+                if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                        g_error_free (error);
+                        return;
+                }
                 g_warning ("failed to download: %s",
                            error->message);
                 g_error_free (error);
@@ -729,6 +740,10 @@ get_updates_finished_cb (GObject *object,
         /* get the results */
         results = pk_client_generic_finish (PK_CLIENT(client), res, &error);
         if (results == NULL) {
+                if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                        g_error_free (error);
+                        return;
+                }
                 g_warning ("failed to get updates: %s",
                            error->message);
                 g_error_free (error);
@@ -902,7 +917,8 @@ set_proxy_cb (GObject *object, GAsyncResult *res, gpointer user_data)
         /* get the result */
         ret = pk_control_set_proxy_finish (control, res, &error);
         if (!ret) {
-                g_warning ("failed to set proxies: %s", error->message);
+                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+                        g_warning ("failed to set proxies: %s", error->message);
                 g_error_free (error);
         }
 }
@@ -1174,8 +1190,9 @@ on_bus_gotten (GObject *source_object,
 
         connection = g_bus_get_finish (res, &error);
         if (connection == NULL) {
-                g_warning ("Could not get session bus: %s",
-                           error->message);
+                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+                        g_warning ("Could not get session bus: %s",
+                                   error->message);
                 g_error_free (error);
                 return;
         }


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