From 11cf4509b1afa2ebfc4a5dcb570c92139a5469cc Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Mon, 21 Nov 2011 15:09:25 +0100 Subject: 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 --- wizard/main.c | 31 +++++++++++-------------------- 1 file 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 -- cgit v1.2.1