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:46:21 +0000 |
commit | 11cf4509b1afa2ebfc4a5dcb570c92139a5469cc (patch) | |
tree | 3be926a445fee60849532a7d5ff646cc879d6cc8 | |
parent | f591ab0c2279425f8561954571c3cdf0c454ead1 (diff) | |
download | gnome-bluetooth-11cf4509b1afa2ebfc4a5dcb570c92139a5469cc.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
-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 8797e5f2..1933c82a 100644 --- a/wizard/main.c +++ b/wizard/main.c @@ -811,39 +811,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 |