[gnome-bluetooth] wizard: Split out update_user_pincode()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] wizard: Split out update_user_pincode()
- Date: Mon, 25 Nov 2013 17:23:33 +0000 (UTC)
commit 99c67d09f6686295cc611ee26bc80d375939e5c5
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 25 18:17:36 2013 +0100
wizard: Split out update_user_pincode()
wizard/main.c | 44 ++++++++++++++++++++++++++------------------
1 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 1ae4c33..f9e06bb 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -212,6 +212,30 @@ replace_target_properties_for_device (GDBusProxy *device)
}
}
+static void
+update_user_pincode (void)
+{
+ const char *pincode;
+
+ pincode = get_pincode_for_device (target_type,
+ target_address,
+ target_name,
+ &target_max_digits);
+ if (pincode != NULL) {
+ if (g_str_equal (pincode, "KEYBOARD"))
+ target_ui_behaviour = PAIRING_UI_KEYBOARD;
+ else if (g_str_equal (pincode, "ICADE"))
+ target_ui_behaviour = PAIRING_UI_ICADE;
+
+ gtk_entry_set_max_length (GTK_ENTRY (entry_custom), target_max_digits);
+
+ g_free (user_pincode);
+ user_pincode = g_strdup (pincode);
+ } else {
+ target_ui_behaviour = PAIRING_UI_NORMAL;
+ }
+}
+
static gboolean
pincode_callback (GDBusMethodInvocation *invocation,
GDBusProxy *device,
@@ -621,24 +645,8 @@ void prepare_callback (GtkWidget *assistant,
target_type = bluetooth_chooser_get_selected_device_type (selector);
target_ui_behaviour = PAIRING_UI_NORMAL;
-
- if (legacypairing == TRUE) {
- const char *pincode = get_pincode_for_device (target_type,
- target_address,
- target_name,
- &target_max_digits);
- if (pincode != NULL) {
- if (g_str_equal (pincode, "KEYBOARD"))
- target_ui_behaviour = PAIRING_UI_KEYBOARD;
- else if (g_str_equal (pincode, "ICADE"))
- target_ui_behaviour = PAIRING_UI_ICADE;
-
- gtk_entry_set_max_length (GTK_ENTRY (entry_custom), target_max_digits);
-
- g_free (user_pincode);
- user_pincode = g_strdup (pincode);
- }
- }
+ if (legacypairing == TRUE)
+ update_user_pincode ();
g_object_ref(agent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]