[gnome-bluetooth] pairing-dialog: Add a "confirm auth" mode



commit 42f7f78f2c54daeaa84c400d07a102c6fdce5aa6
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jul 7 15:16:58 2015 +0200

    pairing-dialog: Add a "confirm auth" mode
    
    The confirm auth mode can be used to allow authenticating devices,
    or services.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752015

 lib/bluetooth-pairing-dialog.c |    9 ++++++++-
 lib/bluetooth-pairing-dialog.h |    3 ++-
 lib/test-pairing-dialog.c      |    3 +++
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/lib/bluetooth-pairing-dialog.c b/lib/bluetooth-pairing-dialog.c
index 0721277..2aa95fc 100644
--- a/lib/bluetooth-pairing-dialog.c
+++ b/lib/bluetooth-pairing-dialog.c
@@ -110,6 +110,12 @@ bluetooth_pairing_dialog_set_mode (BluetoothPairingDialog *self,
                title = g_strdup (_("Bluetooth Pairing Request"));
                help = g_strdup_printf (_("'%s' wants to pair with this device. Do you want to allow 
pairing?"), device_name);
                break;
+       case BLUETOOTH_PAIRING_MODE_CONFIRM_AUTH:
+               gtk_widget_show (priv->done);
+               gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->pin_notebook), MESSAGE_PAGE);
+               title = g_strdup (_("Confirm Bluetooth Connection"));
+               help = g_strdup_printf (_("'%s' wants to connect with this device. Do you want to allow 
it?"), device_name);
+               break;
        default:
                g_assert_not_reached ();
        }
@@ -128,7 +134,8 @@ bluetooth_pairing_dialog_set_mode (BluetoothPairingDialog *self,
                g_assert (help);
        }
 
-       if (mode == BLUETOOTH_PAIRING_MODE_YES_NO) {
+       if (mode == BLUETOOTH_PAIRING_MODE_YES_NO ||
+           mode == BLUETOOTH_PAIRING_MODE_CONFIRM_AUTH) {
                gtk_button_set_label (GTK_BUTTON (priv->done), _("Allow"));
                context = gtk_widget_get_style_context (priv->done);
                gtk_style_context_remove_class (context, "suggested-action");
diff --git a/lib/bluetooth-pairing-dialog.h b/lib/bluetooth-pairing-dialog.h
index 2952b63..85a4602 100644
--- a/lib/bluetooth-pairing-dialog.h
+++ b/lib/bluetooth-pairing-dialog.h
@@ -61,7 +61,8 @@ typedef enum {
        BLUETOOTH_PAIRING_MODE_PIN_DISPLAY_KEYBOARD,
        BLUETOOTH_PAIRING_MODE_PIN_DISPLAY_ICADE,
        BLUETOOTH_PAIRING_MODE_PIN_MATCH,
-       BLUETOOTH_PAIRING_MODE_YES_NO
+       BLUETOOTH_PAIRING_MODE_YES_NO,
+       BLUETOOTH_PAIRING_MODE_CONFIRM_AUTH
 } BluetoothPairingMode;
 
 GType bluetooth_pairing_dialog_get_type (void);
diff --git a/lib/test-pairing-dialog.c b/lib/test-pairing-dialog.c
index f81665e..86a9e70 100644
--- a/lib/test-pairing-dialog.c
+++ b/lib/test-pairing-dialog.c
@@ -67,6 +67,8 @@ int main (int argc, char **argv)
                mode = BLUETOOTH_PAIRING_MODE_PIN_MATCH;
        } else if (g_strcmp0 (argv[1], "yes-no") == 0) {
                mode = BLUETOOTH_PAIRING_MODE_YES_NO;
+       } else if (g_strcmp0 (argv[1], "confirm-auth") == 0) {
+               mode = BLUETOOTH_PAIRING_MODE_CONFIRM_AUTH;
        } else {
                g_print ("Mode '%s' not supported, must be one of:\n", argv[1]);
                g_print ("\tpin-confirmation\n");
@@ -75,6 +77,7 @@ int main (int argc, char **argv)
                g_print ("\tpin-query\n");
                g_print ("\tpin-match\n");
                g_print ("\tyes-no\n");
+               g_print ("\tconfirm-auth\n");
 
                return 1;
        }


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