[gnome-bluetooth] wizard: use values read from the PIN database to initialize the dialog
- From: Daniele Forsi <dforsi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] wizard: use values read from the PIN database to initialize the dialog
- Date: Sun, 18 Dec 2011 18:50:24 +0000 (UTC)
commit f1e5d9186155a07dd2e51e2df7c28728861a1b9c
Author: Daniele Forsi <dforsi src gnome org>
Date: Sun Dec 18 17:25:25 2011 +0100
wizard: use values read from the PIN database to initialize the dialog
If a PIN is found in the database now it can be seen and changed in the
dialog (before it could be changed without seeing the initial value)
and the maximum number of digits is enforced by the text entry (and not
by the other fixed choices else the GUI wouldn't match the silently
truncated PIN used).
wizard/main.c | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 143fb8b..a87920a 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -65,6 +65,7 @@ static BluetoothAgent *agent;
static gchar *target_address = NULL;
static gchar *target_name = NULL;
static gchar *target_pincode = NULL;
+static guint target_max_digits = 0;
static guint target_type = BLUETOOTH_TYPE_ANY;
static gboolean target_ssp = FALSE;
static gboolean create_started = FALSE;
@@ -730,24 +731,10 @@ select_device_changed (BluetoothChooser *selector,
g_free (pincode);
pincode = NULL;
- if (user_pincode != NULL && *user_pincode != '\0') {
- pincode = g_strdup (user_pincode);
- automatic_pincode = TRUE;
- } else if (address != NULL) {
- guint max_digits;
-
- pincode = get_pincode_for_device(target_type, target_address, target_name, &max_digits);
- if (pincode == NULL) {
- /* Truncate the default pincode if the device doesn't like long
- * PIN codes */
- if (max_digits != PIN_NUM_DIGITS && max_digits > 0)
- pincode = g_strndup(target_pincode, max_digits);
- else
- pincode = g_strdup(target_pincode);
- } else if (target_ssp == FALSE) {
- automatic_pincode = TRUE;
- }
- }
+ g_free (user_pincode);
+ user_pincode = get_pincode_for_device (target_type, target_address, target_name, &target_max_digits);
+ automatic_pincode = user_pincode != NULL;
+ gtk_entry_set_max_length (GTK_ENTRY (entry_custom), target_max_digits);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]