| 250 gaim_request_field_choice_set_value(field, id); |
250 gaim_request_field_choice_set_value(field, id); |
| 251 } |
251 } |
| 252 else if (type == GAIM_REQUEST_FIELD_LIST) |
252 else if (type == GAIM_REQUEST_FIELD_LIST) |
| 253 { |
253 { |
| 254 GntWidget *tree = field->ui_data; |
254 GntWidget *tree = field->ui_data; |
| 255 gpointer data = gnt_tree_get_selection_data(GNT_TREE(tree)); |
255 GList *list = NULL; |
| 256 GList *list = g_list_append(NULL, data); /* XXX: Update when multi-select is allowed */ |
256 |
| |
257 if (gaim_request_field_list_get_multi_select(field)) |
| |
258 { |
| |
259 const GList *iter; |
| |
260 |
| |
261 iter = gaim_request_field_list_get_items(field); |
| |
262 for (; iter; iter = iter->next) |
| |
263 { |
| |
264 const char *text = list->data; |
| |
265 gpointer key = gaim_request_field_list_get_data(field, text); |
| |
266 if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
| |
267 list = g_list_prepend(list, key); |
| |
268 } |
| |
269 } |
| |
270 else |
| |
271 { |
| |
272 gpointer data = gnt_tree_get_selection_data(GNT_TREE(tree)); |
| |
273 list = g_list_append(list, data); |
| |
274 } |
| |
275 |
| 257 gaim_request_field_list_set_selected(field, list); |
276 gaim_request_field_list_set_selected(field, list); |
| 258 g_list_free(list); |
277 g_list_free(list); |
| 259 } |
278 } |
| 260 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
279 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
| 261 { |
280 { |
| 353 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
372 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
| 354 GINT_TO_POINTER(gaim_request_field_choice_get_default_value(field))); |
373 GINT_TO_POINTER(gaim_request_field_choice_get_default_value(field))); |
| 355 } |
374 } |
| 356 else if (type == GAIM_REQUEST_FIELD_LIST) |
375 else if (type == GAIM_REQUEST_FIELD_LIST) |
| 357 { |
376 { |
| 358 /* XXX: Yet to allow multi-select, because the feature is absent in GntTree */ |
|
| 359 const GList *list; |
377 const GList *list; |
| |
378 gboolean multi = gaim_request_field_list_get_multi_select(field); |
| 360 GntWidget *tree = gnt_tree_new(); |
379 GntWidget *tree = gnt_tree_new(); |
| 361 gnt_box_add_widget(GNT_BOX(hbox), tree); |
380 gnt_box_add_widget(GNT_BOX(hbox), tree); |
| 362 field->ui_data = tree; |
381 field->ui_data = tree; |
| 363 |
382 |
| 364 list = gaim_request_field_list_get_items(field); |
383 list = gaim_request_field_list_get_items(field); |
| 365 for (; list; list = list->next) |
384 for (; list; list = list->next) |
| 366 { |
385 { |
| 367 const char *text = list->data; |
386 const char *text = list->data; |
| 368 gpointer key = gaim_request_field_list_get_data(field, text); |
387 gpointer key = gaim_request_field_list_get_data(field, text); |
| 369 gnt_tree_add_row_after(GNT_TREE(tree), key, |
388 if (multi) |
| 370 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
389 { |
| 371 if (gaim_request_field_list_is_selected(field, text)) |
390 gnt_tree_add_choice(GNT_TREE(tree), key, |
| 372 gnt_tree_set_selected(GNT_TREE(tree), key); |
391 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
| |
392 if (gaim_request_field_list_is_selected(field, text)) |
| |
393 gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); |
| |
394 } |
| |
395 else |
| |
396 { |
| |
397 gnt_tree_add_row_after(GNT_TREE(tree), key, |
| |
398 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
| |
399 if (gaim_request_field_list_is_selected(field, text)) |
| |
400 gnt_tree_set_selected(GNT_TREE(tree), key); |
| |
401 } |
| 373 } |
402 } |
| 374 } |
403 } |
| 375 #if 0 |
404 #if 0 |
| 376 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
405 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
| 377 { |
406 { |