Mercurial > pidgin.yaz
comparison src/request.c @ 14066:29f03c8fba4a
[gaim-migrate @ 16687]
I think this is better.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 10 Aug 2006 18:18:17 +0000 |
parents | 8bda65b88e49 |
children | c28883e918f0 |
comparison
equal
deleted
inserted
replaced
14065:8ef994bacf3d | 14066:29f03c8fba4a |
---|---|
863 field->u.list.selected_table = | 863 field->u.list.selected_table = |
864 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); | 864 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
865 } | 865 } |
866 | 866 |
867 void | 867 void |
868 gaim_request_field_list_set_selected(GaimRequestField *field, GList *items) | 868 gaim_request_field_list_set_selected(GaimRequestField *field, const GList *items) |
869 { | 869 { |
870 GList *l; | 870 const GList *l; |
871 | 871 |
872 g_return_if_fail(field != NULL); | 872 g_return_if_fail(field != NULL); |
873 g_return_if_fail(items != NULL); | 873 g_return_if_fail(items != NULL); |
874 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST); | 874 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_LIST); |
875 | 875 |
876 gaim_request_field_list_clear_selected(field); | 876 gaim_request_field_list_clear_selected(field); |
877 | 877 |
878 if (!gaim_request_field_list_get_multi_select(field) && | 878 if (!gaim_request_field_list_get_multi_select(field) && |
879 g_list_length(items) > 1) | 879 g_list_length((GList*)items) > 1) |
880 { | 880 { |
881 gaim_debug_warning("request", | 881 gaim_debug_warning("request", |
882 "More than one item added to non-multi-select " | 882 "More than one item added to non-multi-select " |
883 "field %s\n", | 883 "field %s\n", |
884 gaim_request_field_get_id(field)); | 884 gaim_request_field_get_id(field)); |
885 return; | 885 return; |
886 } | 886 } |
887 | 887 |
888 field->u.list.selected = items; | 888 for (l = items; l != NULL; l = l->next) |
889 | |
890 for (l = field->u.list.selected; l != NULL; l = l->next) | |
891 { | 889 { |
890 field->u.list.selected = g_list_append(field->u.list.selected, | |
891 g_strdup(l->data)); | |
892 g_hash_table_insert(field->u.list.selected_table, | 892 g_hash_table_insert(field->u.list.selected_table, |
893 g_strdup((char *)l->data), NULL); | 893 g_strdup((char *)l->data), NULL); |
894 } | 894 } |
895 } | 895 } |
896 | 896 |