Mercurial > pidgin
changeset 30241:b258ffa87424
Fix data selection in a list-type request-field.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 04 Jul 2010 04:06:17 +0000 |
parents | a472bc05fa55 |
children | cfdd4d3ba550 |
files | finch/gntrequest.c |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntrequest.c Sun Jul 04 02:12:51 2010 +0000 +++ b/finch/gntrequest.c Sun Jul 04 04:06:17 2010 +0000 @@ -349,10 +349,9 @@ } else if (type == PURPLE_REQUEST_FIELD_LIST) { - GList *list = NULL; + GList *list = NULL, *iter; if (purple_request_field_list_get_multi_select(field)) { - GList *iter; GntWidget *tree = FINCH_GET_DATA(field); iter = purple_request_field_list_get_items(field); @@ -361,14 +360,23 @@ const char *text = iter->data; gpointer key = purple_request_field_list_get_data(field, text); if (gnt_tree_get_choice(GNT_TREE(tree), key)) - list = g_list_prepend(list, key); + list = g_list_prepend(list, (gpointer)text); } } else { GntWidget *combo = FINCH_GET_DATA(field); gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); - list = g_list_append(list, data); + + iter = purple_request_field_list_get_items(field); + for (; iter; iter = iter->next) { + const char *text = iter->data; + gpointer key = purple_request_field_list_get_data(field, text); + if (key == data) { + list = g_list_prepend(list, (gpointer)text); + break; + } + } } purple_request_field_list_set_selected(field, list); @@ -815,7 +823,7 @@ for (list = purple_request_fields_get_groups(allfields); list; list = list->next) { PurpleRequestFieldGroup *group = list->data; GList *fields = purple_request_field_group_get_fields(group); - + for (; fields ; fields = fields->next) { PurpleRequestField *field = fields->data; PurpleRequestFieldType type = purple_request_field_get_type(field); @@ -826,6 +834,7 @@ switch (type) { case PURPLE_REQUEST_FIELD_LIST: val = purple_request_field_list_get_selected(field)->data; + val = purple_request_field_list_get_data(field, val); break; case PURPLE_REQUEST_FIELD_BOOLEAN: val = GINT_TO_POINTER(purple_request_field_bool_get_value(field));