| 469 } |
469 } |
| 470 |
470 |
| 471 static GntWidget* |
471 static GntWidget* |
| 472 create_choice_field(PurpleRequestField *field) |
472 create_choice_field(PurpleRequestField *field) |
| 473 { |
473 { |
| 474 GList *it; |
|
| 475 GntWidget *combo = gnt_combo_box_new(); |
474 GntWidget *combo = gnt_combo_box_new(); |
| 476 |
475 |
| 477 it = purple_request_field_choice_get_elements(field); |
476 for (GList *it = purple_request_field_choice_get_elements(field); it != NULL; it = g_list_next(it)) |
| 478 while (it != NULL) |
|
| 479 { |
477 { |
| 480 const gchar *text; |
478 PurpleNamedValue *choice = it->data; |
| 481 gpointer value; |
479 |
| 482 |
480 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), choice->value, choice->name); |
| 483 text = it->data; |
|
| 484 it = g_list_next(it); |
|
| 485 g_assert(it != NULL); |
|
| 486 value = it->data; |
|
| 487 it = g_list_next(it); |
|
| 488 |
|
| 489 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), value, text); |
|
| 490 } |
481 } |
| 491 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
482 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
| 492 purple_request_field_choice_get_default_value(field)); |
483 purple_request_field_choice_get_default_value(field)); |
| 493 return combo; |
484 return combo; |
| 494 } |
485 } |
| 602 GntWidget *window, *box; |
593 GntWidget *window, *box; |
| 603 GList *grlist; |
594 GList *grlist; |
| 604 GntWidget *username = NULL, *accountlist = NULL; |
595 GntWidget *username = NULL, *accountlist = NULL; |
| 605 PurpleRequestHelpCb help_cb; |
596 PurpleRequestHelpCb help_cb; |
| 606 gpointer help_data; |
597 gpointer help_data; |
| 607 GSList *extra_actions, *it; |
598 GSList *extra_actions; |
| 608 |
599 |
| 609 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
600 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
| 610 |
601 |
| 611 /* This is how it's going to work: the request-groups are going to be |
602 /* This is how it's going to work: the request-groups are going to be |
| 612 * stacked vertically one after the other. A GntLine will be separating |
603 * stacked vertically one after the other. A GntLine will be separating |
| 688 |
679 |
| 689 box = setup_button_box(window, userdata, request_fields_cb, allfields, |
680 box = setup_button_box(window, userdata, request_fields_cb, allfields, |
| 690 ok, ok_cb, cancel, cancel_cb, NULL); |
681 ok, ok_cb, cancel, cancel_cb, NULL); |
| 691 |
682 |
| 692 extra_actions = purple_request_cpar_get_extra_actions(cpar); |
683 extra_actions = purple_request_cpar_get_extra_actions(cpar); |
| 693 for (it = extra_actions; it; it = it->next->next) { |
684 for (GSList *it = extra_actions; it; it = it->next) { |
| 694 const gchar *label = it->data; |
685 PurpleNamedValue *extra_action = it->data; |
| 695 PurpleRequestFieldsCb *cb = it->next->data; |
686 |
| 696 |
687 GntWidget *button = gnt_button_new(extra_action->name); |
| 697 GntWidget *button = gnt_button_new(label); |
|
| 698 gnt_box_add_widget_in_front(GNT_BOX(box), button); |
688 gnt_box_add_widget_in_front(GNT_BOX(box), button); |
| 699 g_object_set_data(G_OBJECT(button), "ui-handle", window); |
689 g_object_set_data(G_OBJECT(button), "ui-handle", window); |
| 700 g_object_set_data(G_OBJECT(button), "extra-cb", cb); |
690 g_object_set_data(G_OBJECT(button), "extra-cb", extra_action->value); |
| 701 g_object_set_data(G_OBJECT(button), "extra-cb-data", userdata); |
691 g_object_set_data(G_OBJECT(button), "extra-cb-data", userdata); |
| 702 g_signal_connect(G_OBJECT(button), "activate", |
692 g_signal_connect(G_OBJECT(button), "activate", |
| 703 G_CALLBACK(multifield_extra_cb), allfields); |
693 G_CALLBACK(multifield_extra_cb), allfields); |
| 704 } |
694 } |
| 705 |
695 |