| 588 g_free(str); |
588 g_free(str); |
| 589 |
589 |
| 590 return w; |
590 return w; |
| 591 } |
591 } |
| 592 |
592 |
| |
593 static void |
| |
594 multifield_extra_cb(GntWidget *button, PurpleRequestFields *allfields) |
| |
595 { |
| |
596 PurpleRequestFieldsCb cb; |
| |
597 gpointer cb_data; |
| |
598 gpointer handle; |
| |
599 |
| |
600 handle = g_object_get_data(G_OBJECT(button), "ui-handle"); |
| |
601 cb = g_object_get_data(G_OBJECT(button), "extra-cb"); |
| |
602 cb_data = g_object_get_data(G_OBJECT(button), "extra-cb-data"); |
| |
603 |
| |
604 if (cb != NULL) |
| |
605 cb(cb_data, allfields); |
| |
606 |
| |
607 action_performed(button, handle); |
| |
608 purple_request_close(PURPLE_REQUEST_FIELDS, handle); |
| |
609 } |
| |
610 |
| 593 static void * |
611 static void * |
| 594 finch_request_fields(const char *title, const char *primary, |
612 finch_request_fields(const char *title, const char *primary, |
| 595 const char *secondary, PurpleRequestFields *allfields, |
613 const char *secondary, PurpleRequestFields *allfields, |
| 596 const char *ok, GCallback ok_cb, |
614 const char *ok, GCallback ok_cb, |
| 597 const char *cancel, GCallback cancel_cb, |
615 const char *cancel, GCallback cancel_cb, |
| 599 void *userdata) |
617 void *userdata) |
| 600 { |
618 { |
| 601 GntWidget *window, *box; |
619 GntWidget *window, *box; |
| 602 GList *grlist; |
620 GList *grlist; |
| 603 GntWidget *username = NULL, *accountlist = NULL; |
621 GntWidget *username = NULL, *accountlist = NULL; |
| |
622 PurpleRequestHelpCb help_cb; |
| |
623 gpointer help_data; |
| |
624 GSList *extra_actions, *it; |
| 604 |
625 |
| 605 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
626 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
| 606 |
627 |
| 607 /* This is how it's going to work: the request-groups are going to be |
628 /* This is how it's going to work: the request-groups are going to be |
| 608 * stacked vertically one after the other. A GntLine will be separating |
629 * stacked vertically one after the other. A GntLine will be separating |
| 686 } |
707 } |
| 687 gnt_box_add_widget(GNT_BOX(window), box); |
708 gnt_box_add_widget(GNT_BOX(window), box); |
| 688 |
709 |
| 689 box = setup_button_box(window, userdata, request_fields_cb, allfields, |
710 box = setup_button_box(window, userdata, request_fields_cb, allfields, |
| 690 ok, ok_cb, cancel, cancel_cb, NULL); |
711 ok, ok_cb, cancel, cancel_cb, NULL); |
| |
712 |
| |
713 extra_actions = purple_request_cpar_get_extra_actions(cpar); |
| |
714 for (it = extra_actions; it; it = it->next->next) { |
| |
715 const gchar *label = it->data; |
| |
716 PurpleRequestFieldsCb *cb = it->next->data; |
| |
717 |
| |
718 GntWidget *button = gnt_button_new(label); |
| |
719 gnt_box_add_widget_in_front(GNT_BOX(box), button); |
| |
720 g_object_set_data(G_OBJECT(button), "ui-handle", window); |
| |
721 g_object_set_data(G_OBJECT(button), "extra-cb", cb); |
| |
722 g_object_set_data(G_OBJECT(button), "extra-cb-data", userdata); |
| |
723 g_signal_connect(G_OBJECT(button), "activate", |
| |
724 G_CALLBACK(multifield_extra_cb), allfields); |
| |
725 } |
| |
726 |
| |
727 help_cb = purple_request_cpar_get_help_cb(cpar, &help_data); |
| |
728 if (help_cb) { |
| |
729 GntWidget *button = gnt_button_new(_("Help")); |
| |
730 gnt_box_add_widget_in_front(GNT_BOX(box), button); |
| |
731 g_signal_connect_swapped(G_OBJECT(button), "activate", |
| |
732 G_CALLBACK(help_cb), help_data); |
| |
733 } |
| |
734 |
| 691 gnt_box_add_widget(GNT_BOX(window), box); |
735 gnt_box_add_widget(GNT_BOX(window), box); |
| 692 |
736 |
| 693 setup_default_callback(window, cancel_cb, userdata); |
737 setup_default_callback(window, cancel_cb, userdata); |
| 694 gnt_widget_show(window); |
738 gnt_widget_show(window); |
| 695 |
739 |