diff 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
line wrap: on
line diff
--- a/src/request.h	Sun Dec 21 19:58:11 2003 +0000
+++ b/src/request.h	Sun Dec 21 20:51:05 2003 +0000
@@ -104,6 +104,7 @@
 		struct
 		{
 			GList *items;
+			GHashTable *item_data;
 			GList *selected;
 
 			gboolean multiple_selection;
@@ -705,24 +706,12 @@
 /**
  * Creates a multiple list item field.
  *
- * @param id    The field ID.
- * @param text  The optional label of the field.
- * @param items The list of items.
+ * @param id   The field ID.
+ * @param text The optional label of the field.
  *
  * @return The new field.
  */
-GaimRequestField *gaim_request_field_list_new(const char *id, const char *text,
-											  GList *items);
-
-/**
- * Sets the list of items in a list field.
- *
- * The items are not copied. The actual list passed is assigned to the field.
- *
- * @param field The list field.
- * @param items The items.
- */
-void gaim_request_field_list_set_items(GaimRequestField *field, GList *items);
+GaimRequestField *gaim_request_field_list_new(const char *id, const char *text);
 
 /**
  * Sets whether or not a list field allows multiple selection.
@@ -745,12 +734,25 @@
 	const GaimRequestField *field);
 
 /**
+ * Returns the data for a particular item.
+ *
+ * @param field The list field.
+ * @param item  The item text.
+ *
+ * @return The data associated with the item.
+ */
+void *gaim_request_field_list_get_data(const GaimRequestField *field,
+									   const char *text);
+
+/**
  * Adds an item to a list field.
  *
  * @param field The list field.
  * @param item  The list item.
+ * @param data  The associated data.
  */
-void gaim_request_field_list_add(GaimRequestField *field, const char *item);
+void gaim_request_field_list_add(GaimRequestField *field,
+								 const char *item, void *data);
 
 /**
  * Adds a selected item to the list field.