# HG changeset patch # User Stu Tomlinson # Date 1117111765 0 # Node ID aa1df43e474ceebb88cb5529054f481022216a28 # Parent 77cb56ff14e1b0849ab22796b1af299d1e1d3e9d [gaim-migrate @ 12735] Fix multiple choice requests that have 5 or less choices, these use radio buttons and we were returning a "backwards" value because gtk prepends to the list of buttons and we assumed they were being appended. Also fix selecting the default entry when the request is shown. committer: Tailor Script diff -r 77cb56ff14e1 -r aa1df43e474c src/gtkrequest.c --- a/src/gtkrequest.c Thu May 26 12:15:13 2005 +0000 +++ b/src/gtkrequest.c Thu May 26 12:49:25 2005 +0000 @@ -207,7 +207,8 @@ { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) gaim_request_field_choice_set_value(field, - g_slist_index(gtk_radio_button_get_group(button), button)); + (g_slist_length(gtk_radio_button_get_group(button)) - + g_slist_index(gtk_radio_button_get_group(button), button)) - 1); } static void @@ -1149,6 +1150,7 @@ GtkWidget *box; GtkWidget *first_radio = NULL; GtkWidget *radio; + gint i; if (g_list_length(labels) == 2) box = gtk_hbox_new(FALSE, 6); @@ -1157,7 +1159,7 @@ widget = box; - for (l = labels; l != NULL; l = l->next) + for (l = labels, i = 0; l != NULL; l = l->next, i++) { const char *text = l->data; @@ -1167,6 +1169,9 @@ if (first_radio == NULL) first_radio = radio; + if (i == gaim_request_field_choice_get_default_value(field)) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE); + gtk_box_pack_start(GTK_BOX(box), radio, TRUE, TRUE, 0); gtk_widget_show(radio);