gaim/gaim

7eae8e752991
Parents d1622360b519
Children 150d5e5ead24
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.
--- a/src/gtkrequest.c Thu May 26 08:15:03 2005 -0400
+++ b/src/gtkrequest.c Thu May 26 08:49:15 2005 -0400
@@ -190,7 +190,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
@@ -893,6 +894,7 @@
GtkWidget *box;
GtkWidget *first_radio = NULL;
GtkWidget *radio;
+ gint i;
if (g_list_length(labels) == 2)
box = gtk_hbox_new(FALSE, 6);
@@ -901,7 +903,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;
@@ -911,6 +913,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);