comparison src/request.h @ 7909:5be22af4ebfc

[gaim-migrate @ 8569] Reworked the list field API a bit. Items now have data associated with them (which is not automatically freed by the API). committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 21 Dec 2003 20:51:05 +0000
parents 1d0bc32f8038
children 96b71ea64386
comparison
equal deleted inserted replaced
7908:ad4841411ada 7909:5be22af4ebfc
102 } choice; 102 } choice;
103 103
104 struct 104 struct
105 { 105 {
106 GList *items; 106 GList *items;
107 GHashTable *item_data;
107 GList *selected; 108 GList *selected;
108 109
109 gboolean multiple_selection; 110 gboolean multiple_selection;
110 111
111 } list; 112 } list;
703 /*@{*/ 704 /*@{*/
704 705
705 /** 706 /**
706 * Creates a multiple list item field. 707 * Creates a multiple list item field.
707 * 708 *
708 * @param id The field ID. 709 * @param id The field ID.
709 * @param text The optional label of the field. 710 * @param text The optional label of the field.
710 * @param items The list of items.
711 * 711 *
712 * @return The new field. 712 * @return The new field.
713 */ 713 */
714 GaimRequestField *gaim_request_field_list_new(const char *id, const char *text, 714 GaimRequestField *gaim_request_field_list_new(const char *id, const char *text);
715 GList *items);
716
717 /**
718 * Sets the list of items in a list field.
719 *
720 * The items are not copied. The actual list passed is assigned to the field.
721 *
722 * @param field The list field.
723 * @param items The items.
724 */
725 void gaim_request_field_list_set_items(GaimRequestField *field, GList *items);
726 715
727 /** 716 /**
728 * Sets whether or not a list field allows multiple selection. 717 * Sets whether or not a list field allows multiple selection.
729 * 718 *
730 * @param field The list field. 719 * @param field The list field.
743 */ 732 */
744 gboolean gaim_request_field_list_get_multi_select( 733 gboolean gaim_request_field_list_get_multi_select(
745 const GaimRequestField *field); 734 const GaimRequestField *field);
746 735
747 /** 736 /**
737 * Returns the data for a particular item.
738 *
739 * @param field The list field.
740 * @param item The item text.
741 *
742 * @return The data associated with the item.
743 */
744 void *gaim_request_field_list_get_data(const GaimRequestField *field,
745 const char *text);
746
747 /**
748 * Adds an item to a list field. 748 * Adds an item to a list field.
749 * 749 *
750 * @param field The list field. 750 * @param field The list field.
751 * @param item The list item. 751 * @param item The list item.
752 */ 752 * @param data The associated data.
753 void gaim_request_field_list_add(GaimRequestField *field, const char *item); 753 */
754 void gaim_request_field_list_add(GaimRequestField *field,
755 const char *item, void *data);
754 756
755 /** 757 /**
756 * Adds a selected item to the list field. 758 * Adds a selected item to the list field.
757 * 759 *
758 * @param field The field. 760 * @param field The field.