[gnome-settings-daemon/gnome-3-18] media-keys: Fix checking for cancellation



commit cef0c7b2f381852cc4f15dddc2a383a8b60d4a13
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Mar 15 15:00:57 2016 +0100

    media-keys: Fix checking for cancellation
    
    We really don't need to call g_cancellable_is_cancelled() when we
    could just check the error code we get back.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763689

 plugins/media-keys/gsd-media-keys-manager.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 8e5d4f3..5e4b467 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -2730,15 +2730,10 @@ on_bus_gotten (GObject             *source_object,
         GError *error = NULL;
         UpClient *up_client;
 
-        if (manager->priv->bus_cancellable == NULL ||
-            g_cancellable_is_cancelled (manager->priv->bus_cancellable)) {
-                g_warning ("Operation has been cancelled, so not retrieving session bus");
-                return;
-        }
-
         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]