diff options
author | Daniele Forsi <dforsi@src.gnome.org> | 2011-11-21 15:09:25 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2011-11-21 15:47:06 +0000 |
commit | 0686b0361200b3c78c6e742084e2f950793048c0 (patch) | |
tree | 25f5ab48d1f1989b217a4f41ce1e7f0ac408b5bb /wizard | |
parent | 5adb75269fd9bd85fe5179872b958051ff045565 (diff) | |
download | gnome-bluetooth-0686b0361200b3c78c6e742084e2f950793048c0.tar.gz |
wizard: fix PIN dialog not remembering user choice of fixed PIN
User choice wasn't correctly remembered if the user opened the
dialog and did not make any change (in that case the wizard acted
as if the "Automatic PIN selection" choice was selected).
https://bugzilla.gnome.org/show_bug.cgi?id=664476
Diffstat (limited to 'wizard')
-rw-r--r-- | wizard/main.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/wizard/main.c b/wizard/main.c index b53b632d..96d41353 100644 --- a/wizard/main.c +++ b/wizard/main.c @@ -745,39 +745,30 @@ pin_option_button_clicked (GtkButton *button, gpointer data) { GtkWidget *radio; - char *oldpin; - - oldpin = user_pincode; - user_pincode = NULL; gtk_window_set_transient_for (GTK_WINDOW (pin_dialog), GTK_WINDOW (window_assistant)); gtk_window_present (GTK_WINDOW (pin_dialog)); /* When reopening, try to guess where the pincode was set */ - if (oldpin == NULL) + if (user_pincode == NULL) radio = radio_auto; - else if (g_str_equal (oldpin, "0000")) + else if (g_str_equal (user_pincode, "0000")) radio = radio_0000; - else if (g_str_equal (oldpin, "1111")) + else if (g_str_equal (user_pincode, "1111")) radio = radio_1111; - else if (g_str_equal (oldpin, "1234")) + else if (g_str_equal (user_pincode, "1234")) radio = radio_1234; - else + else if (g_str_equal (user_pincode, "NULL")) + radio = radio_none; + else { radio = radio_custom; - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - if (radio == radio_custom) - gtk_entry_set_text (GTK_ENTRY (entry_custom), oldpin); - - if (gtk_dialog_run (GTK_DIALOG (pin_dialog)) != GTK_RESPONSE_ACCEPT) { - g_free (user_pincode); - user_pincode = oldpin; - } else { - g_free (oldpin); + gtk_entry_set_text (GTK_ENTRY (entry_custom), user_pincode); } + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_widget_hide(pin_dialog); + gtk_dialog_run (GTK_DIALOG (pin_dialog)); + gtk_widget_hide (pin_dialog); } static int |