[gnome-bluetooth] settings: Don't show an error when auth is cancelled



commit 5cb047b799ada7bde396b0840f86fb7b74d87483
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Dec 6 17:28:02 2013 +0100

    settings: Don't show an error when auth is cancelled
    
    When the user cancels a pairing, we shouldn't show an error.
    For now it's just a warning, but could be a dialogue in the future.

 lib/bluetooth-settings-widget.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 59a9b6a..e55b2fe 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -655,6 +655,7 @@ create_callback (GObject      *source_object,
        /* Create failed */
        if (ret == FALSE) {
                //char *text;
+               char *dbus_error;
 
                if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                        g_error_free (error);
@@ -664,19 +665,22 @@ create_callback (GObject      *source_object,
 
                turn_off_pairing (user_data, path);
 
-               //FIXME show an error?
+               dbus_error = g_dbus_error_get_remote_error (error);
+               if (g_strcmp0 (dbus_error, "org.bluez.Error.AuthenticationCanceled") != 0) {
+                       //FIXME show an error?
+                       /* translators:
+                        * The '%s' is the device name, for example:
+                        * Setting up 'Sony Bluetooth Headset' failed
+                        */
+                       //text = g_strdup_printf(_("Setting up '%s' failed"), target_name);
 
-               /* translators:
-                * The '%s' is the device name, for example:
-                * Setting up 'Sony Bluetooth Headset' failed
-                */
-               //text = g_strdup_printf(_("Setting up '%s' failed"), target_name);
+                       g_warning ("Setting up %s failed: %s", path, error->message);
 
-               g_warning ("Setting up %s failed: %s", path, error->message);
-
-               //gtk_label_set_markup(GTK_LABEL(label_summary), text);
-               //g_free (text);
+                       //gtk_label_set_markup(GTK_LABEL(label_summary), text);
+                       //g_free (text);
+               }
 
+               g_free (dbus_error);
                g_error_free (error);
                g_free (path);
                return;


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